Skip to main content
๐Ÿ“œ WAYPOINT LESSON

Checkpoint โ€” Restate, Then Sweep

โญโญโญ advancedโณ 25 min read๐Ÿ“ Lesson 215 of 281

Minimum removals to de-overlap intervals: the reframed objective makes the sweep obvious. The W sorts by the wrong endpoint and keeps the wrong survivor.

Checkpoint โ€” Restate, Then Sweep. "Remove the fewest intervals" is the reframed objective: equivalently, keep the maximum number of non-overlapping intervals โ€” the classic exchange-argument structure (sort by right endpoint; keeping the earliest-ending survivor never hurts). The W is the plausible sort-by-left greedy: it keeps a long early interval that shadows several short later ones. On the mixed test the two diverge โ€” construction, not luck.