Skip to main content
📜 WAYPOINT LESSON

Checkpoint — The Sweep Discipline

⭐⭐⭐ advanced⏳ 25 min read📍 Lesson 230 of 281

Max simultaneous closed intervals: +1 at l, −1 at r+1, ties resolved −1-first. The W decrements at r and mis-orders ties — every shared endpoint undercounts.

Checkpoint — The Sweep Discipline. Closed intervals make the delta placement a real theorem: coverage of [l, r] means +1 at l and −1 at r+1, and at a shared coordinate the −1 must process before the +1 (an interval ending at x stops covering x the instant another begins there — both cover x, so order ties as −1 first to count the junction correctly). The W decrements at r and sorts +1/−1 naively: plausible, clean code, wrong at every junction point.