Company: Visa associate SW Engineer_4april
Difficulty: medium
Question 3 A data processing pipeline consists of n services connected 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 a [unclear] 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. Example throughput = [4, 2, 7] scalingCost = [3, 5, 6] budget = 32 To maximize the throughput of the final service, an optimal solution is: 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 When these units are applied in series, they generate a