Requests per minute buckets

Write codeMedium13 min

Your task

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.

Examples

requests_per_minute(timestamps: list[int]) -> list[int]
Example 1
Inputrequests_per_minute([10, 70, 75, 190])
Output[1, 2, 0, 1]