Skip to content
Onsite

Meeting Rooms

EasyP2Coding

Each meeting is an interval [start, end): it starts at start and ends at end, and one person can go straight from a meeting that ends at time t to one that starts at t. Given a list of meetings, return true if one person can attend all of them, meaning no two meetings overlap. An empty list returns true.

Example 1

Input
intervals = [[0,30],[5,10],[15,20]]
Output
false
Why
[0,30) overlaps both of the others.

Example 2

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

Constraints

  • 0 <= intervals.length <= 10^4
  • 0 <= start < end <= 10^6

Hints

Run checks the 3 visible tests, Submit all 10.