Maximum Pipeline Throughput
Learn this problemProblem statement
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) → longExamples
Example 1
throughput = [4, 2, 7]scalingCost = [3, 5, 6]budget = 32return = 10An optimal scaling configuration is shown below.
| Service index | Scale from | Scale to | Times scaled | Cost per scaling | Total cost |
|---|---|---|---|---|---|
| 0 | 4 | 12 | 2 | 3 | 6 |
| 1 | 2 | 10 | 4 | 5 | 20 |
| 2 | 7 | 14 | 1 | 6 | 6 |
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
throughputandscalingCostis a positive integer, andbudgetis a non-negative integer.
More Microsoft problems
- Maximum Strong Team SubarrayOA · Seen Jul 2026
- Minimum Cost K-Capable ModelsOA · Seen Jul 2026
- Alphabetically Smallest PalindromeOA · Seen Jul 2026
- Maximum Reward PointsOA · Seen Jul 2026
- Maximum Strength of Every NeuronOA · Seen Jul 2026
- Neural Network Subnetwork StrengthOA · Seen Jul 2026
- XOR MultiplicationOA · Seen Jul 2026
- Escape Game - Maximize ScoreOA · Seen Jul 2026