Implement Solution.canAttendMeetings to determine whether one person can attend every meeting listed in intervals. Each meeting is represented by a two-element interval [start, end], where start is its beginning time and end is its finishing time.
Two meetings conflict when their time ranges overlap, so the person cannot attend both. A meeting ending at time t and another meeting starting at time t do not conflict.
Return true if all meetings can be attended without any conflict; otherwise, return false.
Example 1:
Input: intervals = []
Output: true
Explanation: With no meetings scheduled, there is no conflict.
Example 2:
Input: intervals = [[8,11],[2,5],[5,8]]
Output: true
Explanation: Each meeting finishes exactly when the next one begins, and meetings that only touch at an endpoint do not conflict.
Example 3:
Input: intervals = [[1,4],[3,6],[7,9]]
Output: false
Explanation: The first two meetings overlap from time 3 through time 4, so both cannot be attended.
Constraints:
0 <= intervals.length <= 10^4Each element of intervals contains exactly 2 integers0 <= intervals[i][0] < intervals[i][1] <= 10^6The input intervals may be provided in any orderNeed help or want more practice?