easyIntervalsPure DSA~13 min
Single Room Feasibility
A single shared meeting room is booked by several requests. Decide whether all requests can run in that one room — i.e. none of them overlap.
Problem
Given an array of intervals where intervals[i] = [start, end], return true if a person could attend all meetings (no two intervals overlap). A meeting ending exactly when another starts does not overlap.
Input
An array intervals of n pairs (0 ≤ n ≤ 10^4), 0 ≤ start < end ≤ 10^6.
Output
A boolean — true if no two meetings overlap.
Constraints
- Touching endpoints (end == start) do not count as overlap
- 0 ≤ intervals.length ≤ 10,000
- start < end for every interval
Examples
Example 1
Input
[[0,30],[5,10],[15,20]]
Output
false
[0,30] overlaps [5,10], so one room cannot hold all.
Example 2
Input
[[7,10],[2,4]]
Output
true
The two meetings are disjoint.