#233EasyIntervals· Overlap Detection
Meeting Room Conflict Check
Input format
`meetings`: an array of `[start, end]` pairs.
Output format
A boolean: true when no two meetings overlap.
Examples
Input: meetings = [[9, 10], [10, 11], [12, 14]]
Output: true
The second meeting starts at minute 10, exactly when the first ends, which is allowed. The third starts after a gap. No overlaps.
Input: meetings = [[1, 5], [4, 8]]
Output: false
Minutes 4 to 5 belong to both meetings, so the room cannot host both.
Input: meetings = [[0, 3], [5, 9], [3, 5], [9, 10]]
Output: true
Sorted by start these are 0-3, 3-5, 5-9, 9-10: each one begins exactly when the previous ends, so the schedule is feasible.
Constraints
- 0 <= meetings.length <= 10^5
- 0 <= start < end <= 10^9
- Meetings are given in no particular order.
- #intervals
- #sorting
- #sweep-line
- #scheduling