The plan is verified, the invariant is stated, the approach has survived its counterexamples — and now the strange part: writing the code is the easiest step. Solvers who find implementation hard are usually paying for skipped earlier phases; transcription of a verified plan is fast. The reasoning replays end with two moves that protect this step and harvest it: implement and retrospect.
Implementation is transcription
The Binary Search replay reaches its implement move with the plan fully specified — inclusive bounds, empty-interval base case, the three-way midpoint comparison already survived its counterexample. The implementation step is translating that plan into the surface syntax. If you find yourself making design decisions here — should this be a while loop, what does the base case return — a decision leaked from the implementation phase back into design, and the cheap place to fix it is back in the plan, not mid-code.
The complexity budget belongs to this phase too, as a final check rather than a new decision: the transcription should already meet the O(log n) requirement the cue scan extracted. If it does not, the plan changed somewhere — find where.
The retrospect: where one problem becomes many
The replay’s final move asks: what was the decisive cue, and why did the approach work? For binary search the answer reads: the sorted order converted one midpoint comparison into a safe half-interval elimination; the invariant explains why the bound updates are correct; the counterexample ruled out the left-only shortcut.
That sentence is the transferable asset. Without it, solving binary search teaches you binary search. With it, you learned the general move — sorted order funds half-interval elimination — which transfers to find-the-peak, first-bad-version, search-answer-space problems, and every variation the grader invents.
The look-back, run by hand
Three questions, asked after any solve:
- What cue in the statement pointed at this approach? (The next problem with that cue will yield to the same move.)
- What was the invariant that made the loop correct? (State it in one sentence. If you cannot, you got lucky, not good.)
- What almost went wrong? (The counterexample you hunted, the boundary you fumbled — that is the lesson with your name on it.)
Sixty seconds. The replays institutionalize the habit by making the retrospect a typed move you cannot skip — and after a few replays, the questions start asking themselves.
The rest of the series
This closes the loop of the series overview. The retrospect’s decisive-cue question sends you back to where the series began: Reading the problem before solving it.