101
0/304
Loading content...
A product analytics team records every application session in a fact table.
Table: sessions
The dashboard needs a fixed distribution across four duration buckets:
Task: Return the number of sessions in each bucket.
Critical output rules:
Supported submission environments:
sessions:
| session_id | duration |
|------------|----------|
| 1 | 30 |
| 2 | 199 |
| 3 | 299 |
| 4 | 580 |
| 5 | 1000 |[
{"session_bucket":"[0,5)","total_sessions":3},
{"session_bucket":"[5,10)","total_sessions":1},
{"session_bucket":"[10,15)","total_sessions":0},
{"session_bucket":"15+","total_sessions":1}
]The first three sessions are below 5 minutes, session 4 is in [5,10), no session is in [10,15), and session 5 is in 15+.
sessions:
| session_id | duration |
|------------|----------|
| 10 | 0 |
| 11 | 300 |
| 12 | 600 |
| 13 | 900 |[
{"session_bucket":"[0,5)","total_sessions":1},
{"session_bucket":"[5,10)","total_sessions":1},
{"session_bucket":"[10,15)","total_sessions":1},
{"session_bucket":"15+","total_sessions":1}
]Boundary values belong to the lower-inclusive bucket except the final open-ended bucket where 900 maps to 15+.
sessions:
| session_id | duration |
|------------|----------|
| 21 | 1200 |
| 22 | 2500 |
| 23 | 901 |[
{"session_bucket":"[0,5)","total_sessions":0},
{"session_bucket":"[5,10)","total_sessions":0},
{"session_bucket":"[10,15)","total_sessions":0},
{"session_bucket":"15+","total_sessions":3}
]All sessions are at least 15 minutes long, so only the final bucket is non-zero.
Constraints