Meeting Rooms II

MediumIntervals
Asked byAmazonFacebookGoogleBloombergMicrosoftOracle

Problem

Given an array of meeting time intervals, return the minimum number of conference rooms required to hold all of the meetings without any overlap within a room.

Examples

Example 1
Input:intervals = [[0,30],[5,10],[15,20]]
Output:2
Example 2
Input:intervals = [[7,10],[2,4]]
Output:1

Constraints

  • 1 <= intervals.length <= 10^4

Solve it in the editor. Sign in free to run your Python or JavaScript against test cases, get a verdict, and track your attempts.

Solve on FeatCode →

How to approach it: the Intervals pattern

Problems about ranges — meeting times, event schedules, ranges on a number line — almost always start with sorting the intervals by start (or end) time, then sweeping through them once.

Look for this pattern when

  • The problem talks about meetings, bookings, ranges, or scheduling.
  • You need to merge overlapping ranges, find gaps, or count how many overlap at once.

Read the full Intervals guide →

Video walkthroughs

Original problem on LeetCode ↗

More Intervals problems