Given an array of meeting time intervals where intervals[i] = [starti, endi], determine if a person could attend all meetings.
Input
intervals: an array of meeting time intervals where intervals[i] = [starti, endi]
Output
true if a person could attend all meetings, false otherwise
Examples
Example 1
Input
intervals = [[0,30],[5,10],[15,20]]
Output: false
Explanation
The meetings overlap, so a person cannot attend all meetings.
Example 2
Input
intervals = [[7,10],[2,4]]
Output: true
Explanation
The meetings don't overlap, so a person can attend all meetings.
Example 3
Input
intervals = [[0,30],[5,10],[15,20],[5,15]]
Output: false
Explanation
The meetings overlap, so a person cannot attend all meetings.
Constraints