Meeting Rooms
You are given a list of meetings in no particular order. intervals[i] = [start, end] means meeting i begins at time start and finishes at time end.
Return true if a single person could attend every meeting, which means no two meetings overlap. A meeting that ends at time t does not clash with one that starts at time t: the person can walk straight from one to the other.
Constraints
0 <= intervals.length <= 10^40 <= start < end <= 10^6
Examples
Example 1
Input: intervals = [[9,10],[13,15],[10,12]] Output: true
In start order the meetings are [9, 10], [10, 12], [13, 15]. Each one ends no later than the next one starts, and ending at 10 while the next starts at 10 is fine.
Example 2
Input: intervals = [[1,5],[8,9],[4,6]] Output: false
The meeting [1, 5] is still running when [4, 6] starts at 4.
Example 3
Input: intervals = [] Output: true
With no meetings there is nothing to clash.
JavaScript you'll use: Sorting and comparators Destructuring, spread and rest
/**
* @param {number[][]} intervals
* @return {boolean}
*/
function canAttendMeetings(intervals) {
}
Ctrl/⌘ + ' runs the examples, Ctrl/⌘ + Enter submits. Use console.log freely: output shows under Console. In the editor, press Esc then Tab to move focus out.