74. Meeting Rooms II
Given an array of meeting time intervals intervals where intervals[i] = [starti, endi], return the minimum number of conference rooms required.
Example 1:
Input: [[0, 30], [5, 10], [15, 20]]
- At time 0, the first meeting starts, so 1 room is required.
- At time 5, the second meeting starts while the first one is still ongoing, so 2 rooms are required.
- At time 10, the second meeting ends, freeing up one room, so 1 room is used.
- At time 15, the third meeting starts, and the room count increases back to 2.
Output: 2 (At the peak, two rooms are required.)
Example 2:
Input: [[7, 10], [2, 4]]
- The first meeting starts at 2 and ends at 4, using 1 room.
- The second meeting starts at 7 and ends at 10, and it doesn't overlap with the first one, so only 1 room is required.
Output: 1 (Only 1 room is needed since there's no overlap between the meetings.)
Now Your Turn!
Pick the correct output for the given inputInput : [[1,2],[11,20],[13,21],[7,21]]
Still unsure what the problem is asking ?
Let’s go through a few more examples, step by step, to make it clearer.
Constraints:
- 1 <= intervals.length <= 104
- 0 <= starti < endi <= 106