Dashboard
#67. Meeting Rooms IIMediumIntervals

Given an array of meeting time interval objects consisting of start and end times [[start_1,end_1],[start_2,end_2],...] (start_i < end_i), find the minimum number of rooms required to schedule all meetings without any conflicts.

Note: (0,8),(8,10) is NOT considered a conflict at 8.

Example 1:

Input: intervals = [(0,40),(5,10),(15,20)]

Output: 2

Explanation: room1: (0,40) room2: (5,10),(15,20)

Example 2:

Input: intervals = [(4,9)]

Output: 1

Constraints:

  • 0 <= intervals.length <= 100,000
  • 0 <= intervals[i].start < intervals[i].end <= 1,000,000
Examples
Example 1:
Input: intervals = [(0,40),(5,10),(15,20)]
Output: 2
Example 2:
Input: intervals = [(4,9)]
Output: 1
Constraints
  • `0 <= intervals.length <= 100,000`
  • `0 <= intervals[i].start < intervals[i].end <= 1,000,000`
Target: O(N) time • O(1) spaceArray / Two Pointers / Greedy / Sorting / Heap (Priority Queue) / Prefix Sum
Socratic AI Tutor
Gemini 3.8 Flash
Loading editor...

Click "Run" or press Ctrl+Enter to execute test cases.