Process Scheduling
Reported by candidates from Blackrock's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
The mistake that sinks a first attempt on this Blackrock OA, reported in March 2026, is treating Process Scheduling like a parallel job problem. It's not. One processor per second, and each use halves that processor's ability with floor division. That's a greedy max-heap problem in disguise. Pick the biggest ability, subtract what it schedules, push back half. Simple once you see it, ugly if you start with binary search on time or sort once and walk the array. If you blank when the clock is running, StealthCoder sits invisibly on your screen as a safety net and reads the problem for you.
The problem
A scheduling system contains several processors. ability[i] represents the maximum number of processes the i-th processor can schedule in one second at its current ability. Scheduling is sequential: in each second, choose exactly one processor to use. That processor may schedule up to its current ability, or fewer if fewer processes remain. Immediately after that second, the used processor's ability becomes floor(current ability / 2). The processor remains available with this reduced ability and may be chosen again in a later second. Processors that are not chosen in a second keep their current ability unchanged. If a processor's ability becomes 0, it cannot schedule any more processes. In particular, ability 1 becomes 0 after one use; it does not keep scheduling one process forever. Therefore, each processor has finite total capacity across all future uses: a + floor(a/2) + floor(a/4) +... until the value becomes 0. Given the initial processor abilities and the total number of processes that must be scheduled, return the minimum number of seconds required to schedule all processes. Do not treat all processors as working in parallel during the same second. Function minimumSchedulingTime(ability: int[], processes: long) → int Examples Example 1 ability = [3,1,7,2,4] processes = 15 return = 4 Use one processor per second. One optimal sequence schedules 7, then 4, then 3, then the final 1 remaining process with any processor whose current ability is at least 1. The remaining process count becomes 8, then 4, then 1, then 0, so the answer is 4. Processors used at ability 1 become 0 afterward. Example 2 ability = [5,3] processes = 8 return = 2 Use the processor with ability 5 in the first second and the processor with ability 3 in the second second. Only one processor is used per second, so the answer is 2. Constraints 1 <= ability.length <= 2 * 10^5 1 <= ability[i] <= 10^9 1 <= processes <= 10^18 It is guaranteed that processes is no larger than the finite total schedulable capacity sum(a + floor(a/2) + floor(a/4) +...) across all processors.
Reported by candidates. Source: FastPrep
Pattern and pitfall
The trick is greedy. Each second you want the largest current ability, because any second spent on a smaller value schedules less. Put all abilities in a max-heap. Pop the top, schedule min(top, remaining), subtract it, increment the second counter, then push floor(top/2) back if it's above 0. Stop when remaining hits 0. The pitfalls are real. Processes goes up to 10^18, so use 64-bit integers. A processor at ability 1 becomes 0 and must not be pushed back, or you loop forever. Also, don't simulate per process, simulate per second. The guarantee says capacity is enough, so you never run out of heap early. Each processor contributes about 30 pops at most, so total work is roughly n * 30 * log n, which is fine for 2 * 10^5. If the heap logic slips under pressure, StealthCoder is the hedge during the live OA.
If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.
You can drill Process Scheduling 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
You've seen the question.
Make sure you actually pass Blackrock's OA.
Blackrock 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 Scheduling FAQ
What's the trick in the Blackrock Process Scheduling problem?+
Greedy with a max-heap. Every second, use the processor with the highest current ability, subtract that from the remaining processes, then push back floor(ability/2) if it's still positive. Count the seconds until remaining reaches zero. Taking the biggest value each time is optimal because no later choice can beat it.
How hard is this problem really?+
Medium. The heap idea is standard. The difficulty is reading the rules carefully: one processor per second, halving after use, ability 1 becoming 0, and 10^18 processes. Candidates who get it wrong usually miss overflow or think processors run in parallel.
Why not binary search on the answer?+
Time isn't monotone in a simple closed form here because each use changes that processor's future ability. You'd have to simulate the greedy choice anyway. The heap simulation already gives the exact answer directly, so binary search adds complexity without helping.
What are the edge cases to test?+
Test a single processor with ability 1 and processes 1. Test large values like 10^9 with processes near 10^18 for overflow. Test the last second where remaining is smaller than the top ability. Also confirm you never push a 0 back into the heap.
How do I prepare in 48 hours for this kind of OA?+
Write the max-heap greedy loop from scratch two or three times in your language, including the halving step. Then do a couple of similar heap problems where you pop, modify, and push back. Know your language's heap API cold, since many default to min-heaps.