Code RoomRate limiter memory leak
HardPrep Room Coding #4010

Rate limiter memory leak

Vibe & agenticNetworking & APIsSenior–Staff~20 min

An AI assistant wrote this Python sliding-window rate limiter: allow at most `limit` requests per `window_seconds` per key. It produced:

It blocks the (limit+1)th rapid request in a quick test. What's wrong, and what makes it fail in production?

Implement
sliding_window_allow(arrival_times_ms: list[int], limit: int, window_ms: int) → list[bool]
Examples
in[[0,100,200,300],3,1000]out[true,true,true,false]
in[[0,100,200,1000],3,1000]out[true,true,true,true]
in[[0,999],1,1000]out[true,false]
What a strong answer looks like

Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it (tests, edge cases, reading critically), and how you’d re-prompt or decompose to get it right.

0:00 of about 20 min

Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.

Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.