Meeting Rooms II

Given an array of meeting time intervals where intervals[i] = [start, end], return the minimum number of conference rooms required so that all meetings can take place without overlap. Pattern focus: Interval Scheduling. Track the earliest finishing meetings first, usually with a min-heap or a sweep over sorted start and end times.

Input Format

intervals = list of meeting intervals [start, end]

Output Format

minimum number of meeting rooms required

Constraints

  • 1 <= intervals.length <= 10^5
  • 0 <= start < end <= 10^9

Examples

Example 1:

Input:

intervals = [[0,30],[5,10],[15,20]]

Output:

2

Explanation:

One room hosts [0,30], and the second room handles the two shorter meetings.

Example 2:

Input:

intervals = [[7,10],[2,4]]

Output:

1

Explanation:

The meetings do not overlap, so a single room is enough.

Example 3:

Input:

intervals = [[1,5],[2,6],[8,9]]

Output:

2

Explanation:

The first two meetings overlap, so two rooms are needed at peak time.

Loading...
Meeting Rooms II - Greedy DSA Problem