Save 25%Black Friday: 25% off all plans — use code BLACKFRIDAY2026 at checkout. Ends Monday, Dec 7.Claim the deal

A company wants to increase the throughput of a message-processing pipeline while staying within a fixed scaling budget.

You are given two integer arrays throughput and scalingCost, both of length n. Service i starts with throughput throughput[i], and one upgrade for that service costs scalingCost[i].

The services form a pipeline, so each message must pass through every service in order. As a result, the throughput of the whole pipeline is the minimum throughput among all services after scaling.

Test Cases
Input
Output
Expected