Maximum Pipeline Throughput
Reported by candidates from Microsoft's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
Microsoft reportedly served this one in July 2026, and the first thing you'll notice is that the budget can be huge, so simulating every scaling purchase one at a time is dead on arrival. The problem is Maximum Pipeline Throughput: n services in series, each with a base throughput and a per-scale cost, and you want the best bottleneck you can afford. The pattern is binary search on the answer. If you blank on the setup during the live OA, StealthCoder runs invisibly on your desktop as a safety net and hands you the structure while you keep typing.
The problem
A data-processing pipeline consists of n services connected in series. The output of service i is the input to service i + 1. The base throughput of service i is throughput[i] messages per minute. Each service can be scaled independently. Scaling service i once costs scalingCost[i]. After scaling that service x times, its throughput becomes throughput[i] * (1 + x). Because the services operate in series, the pipeline throughput is limited by the service with the smallest resulting throughput. Given the arrays throughput and scalingCost, together with a total budget, return the maximum pipeline throughput achievable without spending more than the budget. Function getMaxThroughput(throughput: int[], scalingCost: int[], budget: int) → long Examples Example 1 throughput = [4, 2, 7] scalingCost = [3, 5, 6] budget = 32 return = 10 An optimal scaling configuration is shown below. Optimal scaling configurationService indexScale fromScale toTimes scaledCost per scalingTotal cost 0412236 12104520 2714166 The total cost is 6 + 20 + 6 = 32. The scaled service throughputs are [12, 10, 14], so the serial pipeline throughput is 10. Constraints throughput.length = scalingCost.length For this exercise, assume the pipeline contains at least one service, every value in throughput and scalingCost is a positive integer, and budget is a non-negative integer.
Reported by candidates. Source: FastPrep
Pattern and pitfall
Don't allocate budget greedily. Ask a yes/no question instead: can the pipeline reach throughput T? For each service, the scales needed are ceil(T / throughput[i]) - 1, and the cost is that count times scalingCost[i]. Sum the costs and compare to the budget. Feasibility is monotonic, since if T works then any smaller T works too. So binary search T from the minimum base throughput up to a safe upper bound. The upper bound is where people slip. Use something like min(throughput[i]) * (1 + budget / min cost) or just a large value, and use 64-bit math everywhere because the return type is long. The other pitfall is off-by-one in the ceiling division, so test it on the example: T=10 costs 6+20+6=32, and T=11 doesn't fit. If you freeze on the bound or the overflow, StealthCoder is the hedge during 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.
You can drill Maximum Pipeline Throughput 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 StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Microsoft's OA.
Microsoft 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 Pipeline Throughput FAQ
What's the trick in Maximum Pipeline Throughput?+
Binary search on the answer. Pick a target throughput T, compute the cheapest cost to lift every service to at least T, and check it against the budget. Feasibility is monotonic, so you find the largest T that fits. Each check is a single O(n) pass.
Why doesn't a greedy approach work here?+
Greedily upgrading the current slowest service gets slow when the budget is large, and the step sizes differ per service because costs and base throughputs vary. Binary search sidesteps that by testing a target directly instead of simulating purchases one by one.
How do I compute the cost to reach target T for one service?+
The scales needed are ceil(T / throughput[i]) - 1, because throughput becomes throughput[i] * (1 + x). Multiply by scalingCost[i]. If T is at or below the base throughput, the cost is zero. Sum across all services and compare to the budget.
What overflow issues should I watch for?+
The return type is long for a reason. Scale counts times costs can exceed 32-bit range, especially near a large upper bound. Use 64-bit integers for T, the running cost sum, and the bounds. You can also bail out early once the running sum passes the budget.
How should I prepare in 48 hours for this Microsoft OA?+
Practice the binary-search-on-answer template on two or three problems with a monotonic feasibility check. Then write this one from scratch: feasibility function, bounds, ceiling division, 64-bit sums. Verify against the example, where 10 costs exactly 32. That covers most of what this question tests.