Skip to main content

Interval Schedule Conflict Detector

medium
HeapSortingGreedyIntervalsTop K HeapGreedy Interval
Asked atGoogleAmazonMicrosoftBloombergUber

Problem Description

You manage a conference room calendar. Each meeting is represented as `[startTime, endTime]`. Given a list of meetings, return the **minimum number of conference rooms** required to host all meetings simultaneously without any overlap.

A new meeting can start at the exact moment another ends.

**Example 1:**
```
Input: meetings = [[0, 30], [5, 10], [15, 20]]
Output: 2
Explanation: Meeting [0,30] overlaps with both [5,10] and [15,20], but the latter two do not overlap with each other. Peak concurrency is 2.
```

**Example 2:**
```
Input: meetings = [[7, 10], [2, 4], [11, 15]]
Output: 1
Explanation: No two meetings overlap, so one room is sufficient.
```

Constraints

  • 1 <= meetings.length <= 10^4
  • 0 <= startTime < endTime <= 10^6

Follow-up

Return not just the count but also which specific meetings are assigned to each room.

Hints

Try the problem first. If you get stuck, you can reveal hints one at a time.

Solution

Leaderboard

No entries yet for python.

Be the first — submit an accepted solution.