Code RoomConcurrent cache correctness
HardPrep Room Coding #4493

Concurrent cache correctness

Vibe & agenticConcurrencySenior–Staff~25 min

A coding agent refactored a hot Go service to add a sharded in-memory cache with per-shard mutexes and a background eviction goroutine, claiming a 3x throughput win. The benchmark it ran does show 3x. You don't fully trust the concurrency model — there's a lot of locking and channel signalling you didn't write. Before this ships to a service handling 50k req/s, how do you verify it's actually correct and that the speedup is real?

Implement
simulate_sharded_cache(keys: list[str], shard_count: int, shard_capacity: int) → list[bool]
Examples
in[["a","b","a"],2,2]out[false,false,true]
in[["a","b","a","c","b"],1,2]out[false,false,true,false,false]
in[["ab","ba","cd","dc","ab"],4,2]out[false,false,false,false,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 25 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.