Code RoomFixed window counter limiter
HardPrep Room Coding #1017

Fixed window counter limiter

CodingNetworking & APIsSenior–Staff~35 min

Simulate a per-key fixed-window counter limiter. You get `requests` as a list of [key, timestamp] pairs in non-decreasing timestamp order, a `window` size, and a `limit`. Windows are aligned to multiples of `window`: the window index for time t is t // window. Within each key's current aligned window, the first `limit` requests are ALLOWED and the rest REJECTED; the counter resets when a request lands in a new window for that key. Return the list of booleans in input order.

Implement
fixed_window_limiter(requests: list[list], window: int, limit: int) → list[bool]
Examples
in[[["a",0],["a",1],["a",2],["a",10]],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 35 min
InputExpectedGot
[[["a",0],["a",1],["a",2],["a",10]],10,2][true,true,false,true]not run yetsample