Intervals
Easy

Meeting Rooms

Determine if a person can attend all meetings.
Problem Understanding

Given an array of meeting time intervals intervals where intervals[i] = [starti, endi], determine if a person can attend all meetings.

Example 1:

  • Input: [[0,30],[5,10],[15,20]]
  • Output: false
  • Why? Meeting [0,30] overlaps with both [5,10] and [15,20].

Example 2:

  • Input: [[7,10],[2,4]]
  • Output: true
Algorithm Strategy

We simply need to check if any two intervals overlap. If we sort them by start time, we only need to check adjacent meetings.

  1. Sort: Sort intervals by start time.
  2. Scan: Iterate through the sorted list.
  3. Check: If current.start < previous.end, then there is an overlap. Return false immediately.
  4. Result: If loop finishes without conflict, return true.
Interactive Visualization
Step 1 / 1

Initializing...

1x
See the Logic in Motion
Stop memorizing code. Unlock the full interactive visualizer to master the logic step-by-step.
Unlock VisualizerPREMIUM FEATURE

Stop Guessing, Start Mastering.

Build the FAANG intuition. Master this pattern with optimized implementations, visual dry runs, and our curated collection of high-yield problems.

Start Your Premium Prep