Reported September 2026
Morgan Stanleysorting

Maximum Concurrent Processes

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

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

The data structure this Morgan Stanley OA question hinges on is a sorted event list, or a min-heap of end times if you'd rather sweep by start. Reported in September 2026, Maximum Concurrent Processes hands you inclusive intervals and asks for the peak overlap at any integer minute. It looks like a scheduling problem, but it's a counting problem in disguise. If you know the sweep, it's ten minutes of work. If you blank, StealthCoder is the invisible safety net running during the live OA, reading the prompt and giving you the solution.

The problem

You are given n process logs. Each log is an inclusive integer interval [startTime, endTime], meaning that the process runs at every minute from startTime through endTime.
Return the maximum number of processes that are running simultaneously at any integer minute.

Function
maximumConcurrentProcesses(processLogs: int[][]) → int

Examples
Example 1
processLogs = [[1,3],[2,4],[3,6]]
return = 3
At minute 3, all three inclusive intervals contain that minute, so three processes are running simultaneously.
Example 2
processLogs = [[2,6],[1,2],[3,5]]
return = 2
At minute 2, the first two processes overlap. At minutes 3 through 5, the first and third processes overlap. No minute belongs to all three intervals.

Constraints
Each entry in processLogs contains exactly two integers: [startTime, endTime].
For every process log, startTime <= endTime.
Both endpoints are inclusive.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is turning each interval into two events: +1 at startTime and -1 at endTime + 1. The +1 offset matters because endpoints are inclusive, so a process still runs at its end minute. Sort the events by time, and at equal times process the -1 before the +1 (or just sort tuples, since -1 < +1). Walk through, keep a running count, and track the max. That's O(n log n). The common pitfall is treating endTime as exclusive, which undercounts when one interval ends at minute 3 and another starts at minute 3. Example 1 catches this: the answer is 3 only because the endpoints are inclusive. The heap approach also works: sort by start, pop ends less than the current start, push the new end, track the heap size. If the pattern slips away under pressure, StealthCoder can hand you the sweep during the live OA.

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 Maximum Concurrent Processes 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 Morgan Stanley's OA.

Morgan Stanley 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.

Maximum Concurrent Processes FAQ

What's the trick for Maximum Concurrent Processes?+

Convert each interval into a +1 event at start and a -1 event at end + 1, sort them, and keep a running sum. The highest running sum is your answer. The end + 1 handles the inclusive endpoint cleanly.

How hard is this Morgan Stanley OA question really?+

Easy to medium. It's the classic meeting rooms II pattern with a small inclusive-endpoint twist. If you've seen sweep line or a min-heap of end times once, you can solve it quickly. The only real risk is an off-by-one on the end time.

Should I use a heap or a sweep line?+

Either works at O(n log n). The sweep line is shorter and has fewer bugs. The heap version sorts by start and pops any end time less than the current start. With inclusive ends, pop only when end < start, not when end <= start.

What edge cases should I test?+

Test a single interval, identical intervals, and intervals that touch, like [1,3] and [3,5], which overlap at minute 3 and give 2. Also test one interval nested inside another and fully disjoint intervals, which give 1.

How do I prepare for this in 48 hours?+

Write the sweep line from scratch twice and the heap version once. Then do two related problems: meeting rooms II and a car pooling variant. Focus on the event encoding and tie-breaking order. That covers almost every overlap-counting question you could get.

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

OA at Morgan Stanley?
Invisible during screen share
Get it