Reported August 2025
Maven Clinicsorting

Meeting Rooms II

Reported by candidates from Maven Clinic's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Maven Clinic OA. Under 2s to a working solution.
Founder's read

The detail that matters in the Maven Clinic Meeting Rooms II question, reported in August 2025, is one sentence: a room freed at time t can host a meeting that starts at t. That half-open rule decides whether Example 3 returns 2 or 3. It's a classic interval-overlap problem, and the sorting trick is short once you see it. If you've got the OA in a day or two, nail the tie-breaking and you're done. StealthCoder is there as a safety net on the live OA if your mind goes blank on the edge case.

The problem

You are given meeting time intervals where each row [start, end] uses a half-open interval: a meeting occupies a room from start up to, but not including, end.
Return the minimum number of meeting rooms required so that every meeting can take place. A room whose meeting ends at time t may be reused by another meeting that starts at time t.

Function
minMeetingRooms(intervals: int[][]) → int

Examples
Example 1
intervals = [[0,30],[5,10],[15,20]]
return = 2
The meeting [0,30] overlaps both shorter meetings, but the two shorter meetings do not overlap each other.
Example 2
intervals = [[7,10],[2,4]]
return = 1
The meetings are disjoint, so one room can host both.
Example 3
intervals = [[1,5],[5,9],[5,6]]
return = 2
The room used by [1,5] is available at time 5, while the two meetings beginning at 5 need two rooms together.

Constraints
0 <= intervals.length <= 100000.
Each interval has exactly two integers [start, end].
0 <= start < end <= 10^9.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick: count the maximum number of meetings active at once. Split intervals into two arrays, starts and ends, and sort both. Walk through the starts with a pointer into the ends. If the current start is greater than or equal to the earliest unmatched end, that room frees up, so advance the end pointer. Otherwise you need a new room. The answer is the room count at the finish. The pitfall is the comparison. Use >= because the intervals are half-open, so a meeting ending at 5 and one starting at 5 share a room. Using > gives 3 on Example 3. Also handle the empty input, which returns 0. A min-heap of end times works too, at O(n log n). Sorting the two arrays is simpler and has less to go wrong. If you blank mid-assessment, StealthCoder can surface this approach while the proctor sees nothing.

The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.

If this hits your live OA

You can drill Meeting Rooms II cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as meeting rooms ii. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass Maven Clinic's OA.

Maven Clinic reuses patterns across OAs. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Meeting Rooms II FAQ

What's the trick in Meeting Rooms II?+

You're finding the peak number of overlapping meetings. Sort start times and end times separately, then sweep. Each start that comes before the earliest remaining end needs a new room. Otherwise you reuse one. The peak count is your answer, and it runs in O(n log n).

How do I handle meetings that touch at the same time?+

The problem says a room freed at time t can be reused by a meeting starting at t. So when a start equals an end, treat the room as free. In the sweep, compare with start >= end. In Example 3, [1,5] and [5,6] share a room, so the answer is 2.

Should I use a heap or two sorted arrays?+

Either passes. The heap approach sorts intervals by start and keeps a min-heap of end times. Pop if the top is <= the new start, then push the new end. Two sorted arrays use less code and fewer moving parts. Pick whichever you can write without bugs under pressure.

What edge cases should I test?+

Test an empty list, which returns 0. Test a single meeting, which returns 1. Test fully disjoint meetings, which return 1. Test several meetings starting at the same time, like Example 3. With up to 100000 intervals and values up to 10^9, avoid anything quadratic.

How do I prepare for this in 48 hours?+

Write the two-array sweep from scratch twice, then the heap version once. Run all three examples by hand, especially Example 3 with the boundary tie. Know the complexity: O(n log n) time and O(n) space. That's enough for this problem and for its interval-overlap relatives.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Maven Clinic.

OA at Maven Clinic?
Invisible during screen share
Get it