Description
Given an array of meeting time intervals where intervals[i] = [start, end], return the minimum number of conference rooms required.
Examples
Input:
intervals = [[0,30],[5,10],[15,20]]Output:
2Explanation:
Room 1: [0,30]. Room 2: [5,10] and [15,20].
Input:
intervals = [[7,10],[2,4]]Output:
1Explanation:
No overlap, so 1 room is enough.
Input:
intervals = [[1,4],[2,5],[7,9]]Output:
2Explanation:
The requirement is 2 rooms maximum. Room 1: [1,4] then [7,9]. Room 2: [2,5]. The first two meetings [1,4] and [2,5] overlap (from time 2 to 4), so they need separate rooms. The third meeting [7,9] can reuse Room 1 since it starts after [1,4] ends.
Constraints
- •
1 ≤ intervals.length ≤ 10⁴ - •
0 ≤ start < end ≤ 10⁶