PIXELBANKv9.1.0
Menu

Given an array of meeting time intervals [start, end], find the minimum number of conference rooms required.

Input format: intervals as start,end pairs separated by semicolons.

Example:

Input:
0,30;5,10;15,20
Output:
2
Reasoning:
  • The input intervals are first parsed into individual meeting times: (0,30), (5,10), (15,20)
  • We then determine the overlap of these intervals to find the maximum number of meetings happening at the same time: (0,30) overlaps with (5,10) and (15,20), while (5,10) and (15,20) also overlap with each other
  • The maximum overlap occurs at time 15, when meetings (0,30), (5,10), and (15,20) are all happening, but (5,10) ends before (15,20) ends, and only (0,30) and (15,20) are happening at time 20, thus the maximum number of rooms required is 2, when (0,30) and (5,10) are happening at time 5, and also at time 15 when (0,30) and (15,20) are happening, and (5,10) has already started
  • The final output is the minimum number of conference rooms required, which is 2\boxed{2}

Constraints:

  • 1 <= len(intervals) <= 10^4
  • 0 <= start < end <= 10^6
🔒

Editor locked

The code editor is locked for Pro problems. It is only available for free problems. Please upgrade to gain access to the code editor for all problems.

solution.py

Test Results

0/0
Run code to see test results.
Meeting Rooms II - Medium | PixelBank