Reported July 2026
Amazonsorting

Maximum Concurrent Processes (Bar Raiser Round)

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

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

Amazon reportedly threw this at candidates in a Bar Raiser round, reported July 2026. The whole solution hinges on sorting the start and end times, or a min-heap of end times, so you track how many processes are alive at once. It looks like a simple overlap count, but the inclusive endpoint rule is where people slip. If you've got this OA coming in a day or two, you need the sweep line pattern cold. StealthCoder is a safety net sitting invisibly on your screen if your mind goes blank mid-assessment, but the idea here is small enough to carry in your head.

The problem

🍇 FastPrep match note: This version is based on a reported Amazon SDE2 full-time onsite Bar Raiser round prompt and should match the core task about 90-95%: given process running intervals, return the maximum number running at the same time.
The main uncertainty is whether the original wording explicitly counted endpoints as running; the reported example only reaches 3 if time 3 belongs to both [1, 3] and [3, 6], so we make the inclusive endpoint rule explicit and add a few practice examples and constraints for clarity.
You are given a list of processes. Each process has a running interval represented as [start, end].
A process is considered running at every integer time from start through end, inclusive.
Return the maximum number of processes running at the same time.

Function
maxConcurrentProcesses(intervals: int[][]) → int
Complete the function maxConcurrentProcesses in the editor.
maxConcurrentProcesses has the following parameter:
int intervals[n][2]: each interval is [start, end], where start <= end.
Returns int: the maximum number of processes running concurrently at any time.
Follow-up
How would your answer change if each interval were half-open, meaning [start, end), where the process stops running before end?

Examples
Example 1
intervals = [[1, 3], [2, 5], [3, 6]]
return = 3
At time 3, all three processes are running. Since intervals are inclusive, both [1, 3] and [3, 6] include time 3.
Example 2
intervals = [[1, 2], [3, 4], [5, 6]]
return = 1
No two processes overlap, so the maximum number of concurrent processes is 1.
Example 3
intervals = [[1, 10], [2, 3], [4, 5], [6, 7]]
return = 2
The long-running process overlaps with each shorter process, but the shorter processes do not overlap with one another.
Example 4
intervals = [[1, 4], [2, 6], [4, 8], [6, 9]]
return = 3
At time 4, [1, 4], [2, 6], and [4, 8] are all running because interval endpoints are inclusive.

Constraints
1 <= intervals.length <= 100000
0 <= start <= end <= 1000000000
All start and end values are integers.
Intervals are inclusive: [start, end].

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is an event sweep. Sort starts ascending and ends ascending separately, then walk through them with two pointers. Because intervals are inclusive, a process ending at time t is still running at t, so process starts at t before you process ends at t. That ordering is the whole pitfall. Example 1 only reaches 3 because of it. Alternative: sort by start and keep a min-heap of end times, popping while the heap top is strictly less than the current start, then push the new end and track the heap size. Both run in O(n log n), which matters with 100000 intervals. Don't build a timeline array, since values go up to 1000000000. For the half-open follow-up, flip the rule: ends at t free up before starts at t. If you freeze on the tie-breaking, StealthCoder can hand you the working code in the live OA.

Memorize the pattern. If you can't, run StealthCoder. The proctor sees the IDE. They don't see what's behind it.

If this hits your live OA

You can drill Maximum Concurrent Processes (Bar Raiser Round) 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. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge.

Get StealthCoder

Related leaked OAs

⏵ The honest play

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

Amazon reuses patterns across OAs. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Maximum Concurrent Processes (Bar Raiser Round) FAQ

What's the trick to Maximum Concurrent Processes?+

Treat each interval as two events, a start and an end, sort them, and sweep while counting active processes. Track the max count. With inclusive endpoints, starts at a given time must be processed before ends at that same time, otherwise you undercount.

How hard is this Amazon question really?+

Easy to medium. The algorithm is a standard sweep line or heap. The difficulty is the edge case: inclusive endpoints. Example 1 returning 3 only works if time 3 counts for both [1, 3] and [3, 6]. Get that tie rule right and you're basically done.

Can I use a timeline array of size 1000000000?+

No. Values go up to 1000000000, so a per-time array blows memory. Use sorted events or a heap of end times instead. That keeps it at O(n log n) time and O(n) space, which fits n up to 100000.

How does the half-open follow-up change the answer?+

With [start, end), a process stops before end, so at a tie you process ends first, then starts. In the heap version, pop while the top is less than or equal to the current start. Example 1 would then return 2 instead of 3.

How do I prepare for this in 48 hours?+

Write the two-pointer sweep from memory twice, then the heap version once. Test on the four examples, especially Examples 1 and 4, where endpoints touch. Then practice stating the half-open variant out loud, since the follow-up is likely what a Bar Raiser would ask.

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

OA at Amazon?
Invisible during screen share
Get it