Code RoomNaN propagates through normalization
MediumPrep Room Coding #4218

NaN propagates through normalization

Vibe & agenticAlgorithms & data structuresMid–Senior~16 min

An AI produced this data-cleaning step before training. It runs without error and the model trains, but the loss curve is oddly noisy. Find the silent NaN bug.

Implement
normalize_sensor_readings(readings: list[float], sentinel: float, impute_missing: bool) → list[float]
Examples
in[[2,-999,6],-999,true]out[-1,0,1]
in[[2,-999,6],-999,false]out[-1,1]
in[[0,0,-999,0,0,5],-999,true]out[-0.5,-0.5,0,-0.5,-0.5,2]
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 16 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.