Maximum Concurrent Meeting Time Slots
Reported by candidates from Bloomberg's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
Bloomberg reported this one in June 2020, and the 10^5 meeting cap is the whole story. Checking every pair or every time point is dead on arrival, so you need something near O(n log n). The task is to find every stretch where the global maximum number of meetings overlap, and return those stretches merged. It's an array problem that is really a sweep line over sorted start and end events. If you blank on the event handling in the live OA, StealthCoder runs invisibly as a safety net and gives you the working solution while you keep typing.
The problem
Each meeting occupies the half-open interval [start,end). Return every maximal positive-length interval during which the global maximum number of meetings is active, ordered by time. Merge adjacent output intervals with the same maximum count. Return an empty array when there are no meetings. Function maximumConcurrentSlots(meetings: int[][]) → int[][] Examples Example 1 meetings = [[100,300],[145,215],[200,230],[215,300],[215,400],[500,600],[600,700]] return = [[215,230]] Four meetings are active throughout [215,230), the global maximum. Constraints At most 10^5 meetings. start < end.
Reported by candidates. Source: FastPrep
Pattern and pitfall
The trick is turning each meeting into two events: +1 at start, -1 at end. Sort by time, and at equal times process the -1 before the +1, because intervals are half-open [start,end). That ordering is the classic pitfall. Get it wrong and you invent overlaps that don't exist. Sweep through, grouping events with the same timestamp, and apply all their deltas before checking the count. Track the running count and the max seen so far. When the count hits a new max, clear your result and start a new interval at that time. When it equals the max, start an interval. When it drops below the max, close the open interval at that time. Because you only open and close at change points, adjacent intervals with the same max merge naturally. Empty input returns an empty array. Note the example answer is [215,230), where four meetings overlap. If the sweep logic slips under pressure, StealthCoder is the hedge during the live OA.
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 Maximum Concurrent Meeting Time Slots 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
You've seen the question.
Make sure you actually pass Bloomberg's OA.
Bloomberg 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.
Maximum Concurrent Meeting Time Slots FAQ
What's the trick to Bloomberg's Maximum Concurrent Meeting Time Slots?+
Sweep line. Convert each meeting to a +1 start event and a -1 end event, sort them, and walk through keeping a running count. Record intervals where the count equals the global max. It's O(n log n) from the sort, which fits the 10^5 limit easily.
Why does the order of events at the same timestamp matter?+
Intervals are half-open, so a meeting ending at 215 and another starting at 215 don't overlap. Process ends before starts, or apply all deltas at one timestamp before reading the count. Otherwise you inflate the max and return wrong intervals.
How do I handle the merge requirement for adjacent intervals?+
Only open an interval when the count reaches the max and only close it when the count drops below the max. If the count stays at max across several events, nothing closes in between, so the interval stays merged. Equal timestamps need all deltas applied first.
Can I solve it with brute force?+
Not with up to 10^5 meetings. Checking each meeting against every other is O(n^2), and scanning every time unit depends on the value range. Sorting events and sweeping once is the intended approach, and it's short to code.
How should I prepare in 48 hours for this kind of question?+
Write the sweep line solution from scratch two or three times. Use meeting-rooms style variants, then add the max-interval tracking and half-open boundary handling. Test edge cases: empty input, one meeting, back-to-back meetings, and ties for the max in separate spots.