Mid/Senior
Meeting Rooms II
Given an array intervals where intervals[i] = [start_i, end_i] represents the start and end times of a meeting, determine the minimum number of conference rooms required so that all meetings can take place.
Return the minimum number of rooms needed to schedule every meeting without overlap in the same room.
Example 1
0-----------------------------------------------------------30
5---------10
15--------20Input
intervals = [[0,30],[5,10],[15,20]]Output
2The meeting from 0 to 30 overlaps with both other meetings, so at least 2 rooms are required.
Example 2
7-----10 2---4
Input
intervals = [[7,10],[2,4]]Output
1The two meetings do not overlap, so they can use the same room.
Constraints
- 1 <= intervals.length <= 10^4
- 0 <= start_i < end_i <= 10^6