Fixed window rate limiter
Implement a fixed-window rate limiter per client. Time is divided into fixed windows of `window` seconds aligned to zero: the window for timestamp t is floor(t / window). Each client may make at most `limit` requests per window; requests beyond the limit in the same window for the same client are rejected. Given a list of [timestamp, client_id] requests in non-decreasing timestamp order, return a list of booleans (allowed/rejected) per request.
Implement
fixed_window_limiter(requests: list[list], window: int, limit: int) → list[bool]Examples
in
[[[0,"a"],[1,"a"],[2,"a"],[10,"a"]],10,2]out[true,true,false,true]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 25 min
solution.py
InputExpectedGot
[[[0,"a"],[1,"a"],[2,"a"],[10,"a"]],10,2][true,true,false,true]not run yetsample