Intervals
Interval problems involve ranges that may overlap — merging, inserting, or counting them. The near-universal first step is to sort by start (or end) time, after which a single sweep resolves the overlaps.
4 LeetCode problems solved with the Intervals pattern. Practice them with spaced repetition so the pattern sticks.
- Insert IntervalMEDIUM · O(n)
- Meeting RoomsEASY · O(n log n)
- Merge IntervalsMEDIUM · O(n log n)
- Non-overlapping IntervalsMEDIUM · O(n log n)
See the full solution
The complete approach, reference solutions in 5 languages, and a step-by-step visualization — then add this problem to your spaced-repetition schedule.
Start free →