Junior

Meeting Rooms

Given an array intervals where intervals[i] = [start_i, end_i] represents the start and end time of the ith meeting, determine whether a person could attend all meetings.

Return true if no two meetings overlap; otherwise, return false. A meeting ending at time t does not overlap with another meeting starting at time t.

Example 1
0-----------------------------------------------------------30
          5---------10
                              15--------20
Inputintervals = [[0,30],[5,10],[15,20]]
Outputfalse
The meeting from 0 to 30 overlaps with both later meetings, so the person cannot attend all meetings.
Example 2
          7-----10
2---4
Inputintervals = [[7,10],[2,4]]
Outputtrue
The meetings do not overlap because one ends before the other starts.

Constraints

  • 0 <= intervals.length <= 10^4
  • intervals[i].length == 2
  • 0 <= start_i < end_i <= 10^6

Asked at 10 companies

</>

Your Solution

(Ctrl/Cmd + Enter)

Switching Language

Loading template...

Loading...

Sign in to save your progress

AI code evaluation

Get a correctness verdict, missed edge cases, and complexity analysis of your solution.

Sign in to evaluate