Given a list of meeting time intervals, decide whether one person can attend them all — that is, whether no two meetings overlap. A meeting may start the minute another ends.
Examples
Example 1:
Input: intervals = [[0,30],[5,10],[15,20]]
Output: false
Example 2:
Input: intervals = [[7,10],[2,4]]
Output: true
Example 3:
Input: intervals = [[1,5],[5,8]]
Output: true
Explanation: back to back is attendable.
Example 4:
Input: intervals = [[6,7],[2,4],[8,12]]
Output: true
Constraints
1 <= intervals.length <= 10^4
intervals[i] is [start, end] with 0 <= start <= end <= 10^6
Prerequisites
Sorting as a setup move — most interval problems are one sort away from a single sweep, and choosing whether to sort by START or by END is the decision that matters.
How to think about it
1. Neighbours After Sorting Optimal
Intuition
Sorted by start, a conflict can only exist between adjacent meetings — if a meeting overlaps any earlier one, it overlaps its immediate predecessor. One pass over neighbours settles it, and back-to-back meetings are fine, so the comparison is strict.
Algorithm
1. Sort by start. 2. If any meeting starts strictly before the previous one ends, return false. 3. Otherwise all meetings are attendable.