Code RoomRate limiter test specification
HardPrep Room Coding #4114

Rate limiter test specification

Vibe & agenticAlgorithms & data structuresSenior–Staff~18 min

You're about to ask an AI agent to write the test suite for a new rate limiter (token-bucket: capacity, refill rate, per-key buckets) in Rust. You know that if you just say 'write thorough tests,' you'll get happy-path tests pinned to whatever the implementation happens to do. Write the prompt/spec you'd give the agent so the tests verify the real contract — and name the one thing a vague prompt gets most wrong here.

Implement
token_bucket_decisions(capacity: int, refill_per_sec: int, keys: list[str], times: list[int]) → list[bool]
Examples
in[2,1,["a","a","a"],[0,0,0]]out[true,true,false]
in[2,1,["a","a","a","a"],[0,0,1,1]]out[true,true,true,false]
in[1,1,["a","b","a"],[0,0,0]]out[true,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 18 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.