Company: uber_14oct
Difficulty: medium
Efficient Scaling Problem Description A data processing pipeline consists of n services in series where the output of service i serves as input to service i+1 . Each service has varying latency, and the throughput of the i th service is represented by throughput[i] in messages per minute. Each service can be scaled up independently. Scaling up the i th service one unit of time costs scalingCost[i] , and after scaling up x times, the service can process throughput[i] * (1 + x) messages per minute. Given throughput and scalingCost arrays of size n , and a budget value, determine the optimal scaling configuration to maximize the throughput of the final service. Return the maximum throughput possible. Illustrative Example: Consider throughput = [4, 2, 7] , scalingCost = [3, 5, 6] , budget = 35 . To maximize the throughput of the final service, an optimal solution might involve scaling as follows: Service Index | Throughput | Scale To | Times Scaled | Cost per Scaling | Total Cost ---------