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--------20Input
intervals = [[0,30],[5,10],[15,20]]Output
falseThe meeting from 0 to 30 overlaps with both later meetings, so the person cannot attend all meetings.
Example 2
7-----10 2---4
Input
intervals = [[7,10],[2,4]]Output
trueThe 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