0PricingLogin
Competitive Programming Academy · Lesson

Merge Overlapping Intervals

Combine ranges that touch or overlap.

The Merge Goal

Given many intervals, you want to merge the ones that touch or overlap into the fewest possible non-overlapping ranges. 🧩

When Two Intervals Overlap

Two intervals overlap when one starts before the other ends. After sorting by start, that means the next start is at or below the current end.

All lessons in this course

  1. Sort Intervals by Start
  2. Merge Overlapping Intervals
  3. Line Sweep for Max Overlap
  4. Minimum Removals for No Overlap
← Back to Competitive Programming Academy