Requests per minute buckets
You are given the arrival times of requests at a web server as integer Unix seconds, in non-decreasing order (all values non-negative). Build a requests-per-minute series: minute buckets are aligned to multiples of 60, so a timestamp t belongs to bucket t / 60 rounded down. Return the count for every bucket from the first event's minute through the last event's minute, inclusive — quiet minutes in between must appear as 0. Return an empty list for an empty input.
Implement
requests_per_minute(timestamps: list[int]) → list[int]Examples
in
[[10,70,75,190]]out[1,2,0,1]What a strong answer looks like
State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
0:00 of about 13 min
solution.py
InputExpectedGot
[[10,70,75,190]][1,2,0,1]not run yetsample