Code RoomConcurrent map write race
HardPrep Room Coding #4009

Concurrent map write race

Vibe & agenticConcurrencySenior–Staff~20 min

You asked an AI assistant for a concurrent word-count over a list of documents in Go, combining results into one map. It produced:

(Assume the closure capture is fixed to the obvious form.) It returns plausible counts in a small run. What's the defect?

Implement
merge_word_counts(docs: list[str], shard_count: int) → list[str]
Examples
in[["go go gopher","go home"],2]out["go=3","gopher=1","home=1"]
in[["go go gopher","go home"],1]out["go=3","gopher=1","home=1"]
in[[" a b ","b\tc"],4]out["a=1","b=2","c=1"]
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.