PROBLEM 66 OF 75

Meeting Rooms

Decide whether one person can attend all meetings.

PATTERNIntervals & sweep lineAfter sorting, only the active frontier can conflict.
SPOT THE SIGNAL

Why does this pattern fit?

FRAME · 1 OF 4

Restate the exact job

Decide whether one person can attend all meetings.

WHY THIS FITS

After sorting by start, only adjacent meetings can reveal an overlap.

COMPLEXITY

O(n log n) time · O(1) extra after sort

COMMON FAILURE

Treating a meeting ending exactly when another starts as overlap.

THE REASONING, IN ONE PLACE

How to solve Meeting Rooms

The goal is to solve this problem from the pattern, not to memorize a finished answer. Use this as a check after your own attempt.

What the question asks

Decide whether one person can attend all meetings.

Why Intervals & sweep line fits

After sorting by start, only adjacent meetings can reveal an overlap.

State to maintain

Sorted intervals and previous end.

Transition

Reject if current start < previous end; otherwise advance.

Time and space

O(n log n) time · O(1) extra after sort

Counterexample to the tempting mistake

Treating a meeting ending exactly when another starts as overlap.

Prove it again tomorrow

Close this page. Rebuild the state and transition from memory, write a test that exposes the mistake above, then solve a fresh input without looking back. A same-day reread is practice, not proof of retention.

Open blank recall ↗