2025-09-03
Double-Checking Recurrence Bases
By Nino Kvaratskhelia
dynamic programming · proofs
2025-09-03
By Nino Kvaratskhelia
dynamic programming · proofs
Most incorrect DP tables we review share a pattern: the recursive story sounds fine, but the base rows were copied from a different problem shape.
We now require a literal table row labeled “empty input” even when the platform hides it. Participants compare three adjacent rows before coding—yes, it feels bureaucratic, yet it prevents silent off-by-one shifts when constraints change mid-sprint.
During office hours we ask for a spoken story: “What does it mean to process zero items?” If the answer wobbles, we reset the derivation instead of patching code.
This discipline carries into interview practice: you can narrate bases without touching the keyboard, which buys calm when the clock is loud.