Debug and fix practice problems

16 problems · 0 solved

Every problem here starts with code that runs but is wrong. The statement says what the function should do, the starter has one realistic bug, and the tests catch it. These are the bugs that show up in real training loops, eval scripts and agents: a softmax that overflows, LayerNorm over the wrong axis, a causal mask that hides the diagonal, Adam without bias correction, a learning rate stuck at zero from integer division, a scaler fit on test data, a KV cache that grows the wrong axis and a chat history shared between users. Read the spec first, run the tests, then find the line that breaks it. Debugging is most of the job, and interviews increasingly hand you broken code instead of a blank file.

Easy 9

Medium 7

Related topics

All practice problems