Skip to content
Decoder

Meeting Rooms

Easy

Problem

Each meeting is a pair [start, end]. Return true if one person could attend all of them, meaning no two meetings overlap. A meeting that ends at 10 and one that starts at 10 do not clash.

Example 1

Input
[[0, 30], [5, 10], [15, 20]]
Output
false
Why
[0, 30] overlaps both others

Example 2

Input
[[7, 10], [2, 4]]
Output
true

Example 3

Input
[[1, 5], [5, 10]]
Output
true
Why
back to back is fine

Constraints

  • 0 <= intervals.length <= 10^4
  • 0 <= start < end <= 10^6
  • The input is not sorted.

Read it once before you touch anything

Want some pressure? Start the timer. In an interview you get about two minutes to understand the problem.

  1. 1Read the goalWhat goes in, what comes out
  2. 2Scan the examplesCheck one by hand
  3. 3Note the constraintsThey set your Big O
Say what it asks in one sentence
Say it out loud first, then compare with ours.