Skip to main content
๐Ÿ“œ WAYPOINT LESSON

Checkpoint: the sandwich count

โญโญโญ advancedโณ 20 min read๐Ÿ“ Lesson 212 of 256

Window-of-three scanning with an exact equality pattern.

Window problems look innocent and punish the boundaries: the loop runs from 1 to length - 2 (inclusive), and both window edges are compared to the middle. Write the window indexes in the margin before coding.