Code RoomDouble-submit charge race condition
HardPrep Room Coding #4085

Double-submit charge race condition

Vibe & agenticConcurrencySenior–Staff~19 min

An AI wrote this checkout button with a guard against double-submit. Under fast double-clicks it still charges the card twice. Explain the race.

Implement
settled_charge_indices(click_times: list[int], keys: list[str], charge_ms: int) → list[int]
Examples
in[[0,30],["k1","k1"],500]out[0]
in[[0,600],["k1","k2"],500]out[0,1]
in[[0,600],["k1","k1"],500]out[0]
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 19 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.