Minimum Meeting Rooms
Reported by candidates from JP Morgan's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
The detail that decides this one is the touching boundary: a meeting ending at time 5 and another starting at 5 can share a room. That's the JP Morgan Minimum Meeting Rooms question reported in September 2026, and it's a classic interval-overlap problem dressed up as scheduling. With up to 2 million meetings, a lazy approach will time out. If you've got an OA invite, learn the sort-and-sweep idea and the tie rule below. If you blank mid-assessment, StealthCoder is the invisible safety net that reads the problem on screen and hands you the solution.
The problem
You are given a list of n meetings, where each meeting is represented by a start time and an end time. Your task is to determine the minimum number of meeting rooms required so that: No two meetings in the same room overlap. A meeting that ends at time t and another that starts at time t do not overlap and can use the same room. Each meeting is given as: meetingTimings[i] = [start, end] Return the minimum number of rooms needed to schedule all meetings. Function minMeetingRooms(meetingTimings: int[][]) → int Examples Example 1 meetingTimings = [[1,4],[1,5],[5,6],[6,10],[7,9]] return = 2 Suppose n = 5 and meetingTimings = [[1, 4], [1, 5], [5, 6], [6, 10], [7, 9]]. Output: 2 At time 1, meetings 1 and 2 start; meetings running: 1, 2. At time 4, meeting 1 ends; meeting running: 2. At time 5, meeting 2 ends and meeting 3 starts; meeting running: 3. At time 6, meeting 3 ends and meeting 4 starts; meeting running: 4. At time 7, meeting 5 starts; meetings running: 4, 5. At time 9, meeting 5 ends; meeting running: 4. At time 10, meeting 4 ends. Meetings 1 and 2 overlap, as do 4 and 5. At least two meeting rooms are required. Constraints 1 <= meetingTimings.length <= 2 * 10^6 meetingTimings[i].length == 2 1 <= meetingTimings[i][0] <= meetingTimings[i][1] <= 2 * 10^6
Reported by candidates. Source: FastPrep
Pattern and pitfall
The trick is to count how many meetings are running at the same moment. Sort all start times and all end times separately. Walk through the starts with a pointer into the ends. If the next end time is less than or equal to the current start, a room frees up, so advance the end pointer. Otherwise you need a new room. Track the max. The pitfall is the tie: the problem says end at t and start at t don't overlap, so use <= when comparing, not <. Another pitfall is a brute-force pairwise check, which dies at 2 * 10^6 entries. A min-heap of end times also works, but two sorted arrays are lighter. Complexity is O(n log n) for the sorts and O(n) for the sweep. If the tie rule slips your mind live, StealthCoder is the hedge that catches it.
If you see this problem in your OA tomorrow, the play is to recognize the pattern in 30 seconds. StealthCoder buys you that recognition.
You can drill Minimum Meeting Rooms 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 by an Amazon engineer who passed his OA cold and still thinks the filter is broken.
Get StealthCoderRelated leaked OAs
This OA pattern shows up on LeetCode as meeting rooms ii. If you have time before the OA, drill that.
You've seen the question.
Make sure you actually pass JP Morgan's OA.
JP Morgan reuses patterns across OAs. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Minimum Meeting Rooms FAQ
What's the trick for Minimum Meeting Rooms?+
Separate the starts and ends into two sorted arrays. Sweep through the starts. If the earliest unfinished end is at or before the current start, reuse that room. Otherwise add one. The answer is the peak count of rooms in use at any point.
How do I handle meetings that end exactly when another starts?+
They don't overlap, so they share a room. In the sweep, compare with end <= start to free the room. Using strict less-than gives the wrong answer on Example 1, where meetings ending at 5 and 6 chain into the next ones.
Will a brute-force solution pass the constraints?+
No. With n up to 2 * 10^6, checking every pair is O(n^2) and will time out. You need O(n log n) from sorting. Either two sorted arrays with pointers or a min-heap of end times works.
Should I use a heap or two sorted arrays?+
Both are O(n log n). Two sorted arrays are simpler and use less memory, which matters at 2 * 10^6 entries. A heap is fine if you sort meetings by start and pop the smallest end when it's at or before the new start.
How do I prepare for this in 48 hours?+
Code the two-pointer sweep from scratch twice. Test it on Example 1, which should return 2, and on a single meeting, which returns 1. Also test all meetings sharing identical times. Check that your tie rule uses <=. That covers nearly every failure mode.