Process Execution Time
Reported by candidates from IBM's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
IBM asked this in November 2025, and it's a classic interval merging problem disguised as a scheduling question. You have overlapping process windows and need to find the total time any process runs. The trick is that you can't just sum individual intervals. You merge overlaps first, then count. StealthCoder will have the merge logic ready if you blank on the sorting step.
The problem
You are given the inclusive start and end times of multiple processes. Compute the total amount of time during which at least one process is running. Intervals are inclusive, so a process running from 1 to 5 contributes 5 - 1 + 1 = 5 units of time. Overlapping intervals should be merged before summing their lengths. Return the total covered time. The first two processes merge into [1, 6] for 6 units. The third process contributes 3 more units from [8, 10]. Total = 9.
Reported by candidates. Source: FastPrep
Pattern and pitfall
The pattern is interval merging. Sort all intervals by start time, then iterate through and merge any overlapping ranges. The key detail: inclusive boundaries mean a process from 1 to 5 is 5 units, not 4. After merging, sum the lengths of disjoint intervals. Common mistake: forgetting to add 1 for inclusive end times, or not checking if the next interval overlaps the current merged one before extending. The algorithm runs in O(n log n) time. StealthCoder acts as your safety net during the live OA if the merge condition trips you up under pressure.
If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.
You can drill Process Execution Time 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 would have shipped this the night before his JPMorgan OA if he'd had it.
Get StealthCoderRelated leaked OAs
This OA pattern shows up on LeetCode as merge intervals. If you have time before the OA, drill that.
You've seen the question.
Make sure you actually pass IBM's OA.
IBM reuses patterns across OAs. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Process Execution Time FAQ
Do I really need to sort the intervals first?+
Yes. Without sorting by start time, you can't reliably detect overlaps or merge in a single pass. It's the foundation. Sort, then merge left to right.
What counts as an overlap?+
If current interval start is less than or equal to the last merged interval's end, they overlap. Extend the merged interval's end to the max of the two ends. Watch off-by-one errors with inclusive boundaries.
Why is the inclusive boundary so important here?+
A process from 1 to 5 runs for 5 units, not 4. When you sum merged intervals, use (end - start + 1) for each, not (end - start). That extra 1 matters.
Is there a way to solve this without sorting?+
Not efficiently. A hash-based counting approach exists but it's slower and messier. Sorting and merging is the clean, expected solution for this pattern.
What's the most common pitfall on this question at IBM?+
Forgetting to add 1 to the interval length formula. People calculate (end - start) and lose a unit on every interval. Test with simple cases like [1, 1] which should be 1 unit, not 0.