Code Room
CodingMediumcod-g688
Subject Rate limiter designLevel Mid–Senior~25 minCommon in Networking & APIs interviewsIndustries Software development, Technology

Question

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.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.