0PricingLogin
Competitive Programming Academy · Lesson

Sort Intervals by Start

Order events before processing.

What an Interval Is

An interval is just a pair of numbers, a start and an end, like [2, 5]. Most interval problems are a list of these pairs. 📏

Order Brings Sanity

Raw intervals arrive in any order, which makes them hard to reason about. Sorting them first turns chaos into a clean left-to-right sweep.

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