Intervals Cheat Sheet
You sort the [start, end] pairs by start and scan once. That single pass answers overlap and merge questions without comparing every pair.

Earn the full sheet below.
When to use it
- You get [start, end] pairs and need to find or merge overlaps.
- The problem talks about meetings, schedules, or conflicting ranges.
- Sorting by start turns pairwise comparison into a single scan.
- If you need the one right of a target, use Modified Binary Search.
What's on the sheet
The whole trick is to sort, scan, and merge. Step 3 decides what overlap means.
- Sort by start. Sorting turns overlap checks into one left-to-right scan.
- Unpack the pair. a is the interval you kept; b is the one you just met.
- Check for overlap. Decide what happens when two intervals touch.
- Return. Hand back whatever the scan built.
Watch out
- Sort by start, not by end. The overlap check (b_start <= a_end) assumes starts are in order.
- Use <= rather than <. Back-to-back intervals like [1, 3] and [3, 5] usually count as overlapping.
- Meeting Rooms I just needs a yes or no on the first overlap. Skip the merged list.
How to earn it
Solve half of the Intervals problems and the sheet is yours. A free account works fine, and everyone earns their sheets the same way.
Want to see a finished sheet first? Preview the Two Pointers sample.
Every pattern has a sheet. See the full set.