Description
Given an array of meeting time intervals consisting of start and end times, determine if a person could attend all meetings without any overlap. Return true if possible, false otherwise.
Examples
Input:
intervals = [[0,30],[5,10],[15,20]]Output:
falseExplanation:
[0,30] overlaps with others.
Input:
intervals = [[7,10],[2,4]]Output:
trueExplanation:
Intervals [2,4] and [7,10] do not overlap, so all meetings can be attended.
Input:
intervals = [[1,5],[6,8],[9,12]]Output:
trueExplanation:
All meetings are scheduled consecutively without any time overlap. Meeting 1 ends at time 5, meeting 2 starts at time 6, meeting 2 ends at time 8, and meeting 3 starts at time 9.
Constraints
- •
0 ≤ intervals.length ≤ 10⁴