Code RoomInterval leaks across navigation
MediumPrep Room Coding #4207

Interval leaks across navigation

Vibe & agenticAlgorithms & data structuresMid–Senior~15 min

An AI wrote this React Native countdown component for a limited-time offer. It works on screen, but after navigating between offers a few times, performance degrades and you see the timer 'tick' firing multiple times per second and warnings about setting state on an unmounted component. What's wrong and how would you fix it?

Implement
simulate_interval_leak(event_lines: list[str], has_dependency_array: bool, has_cleanup: bool) → list[int]
Examples
in[["render","tick","render","tick","render","tick","unmount","tick"],false,false]out[3,3]
in[["render","tick","render","tick","render","tick","unmount","tick"],true,true]out[0,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 15 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.