Skip to main content
๐Ÿ“œ WAYPOINT LESSON

Checkpoint: longest run

โญ beginnerโณ 25 min read๐Ÿ“ Lesson 72 of 256

A full spec-to-code cycle: run boundaries, best-so-far, reset discipline.

The pattern: the run counter increments while consecutive chars match, resets to 1 when they don't, and the BEST never resets. The W breaks exactly that last clause โ€” best-so-far variables must never move backwards. Trace "abbbcc" by hand before coding: a(1) b(2) b(3) b->reset... the table IS the algorithm.