Company: Amazon_8feb
Difficulty: medium
Optimize Reserved Concurrency Problem Description You're the on-call SDE for a serverless production stack. The architecture includes n AWS Lambda functions, and each function i currently has a reserved-concurrency limit of conc[i] . Because burst load on one function can starve others, your principal engineer asks that every function end up with a distinct concurrency limit. In one operation, you may raise function i 's limit by exactly 1, incurring a cost of price[i] (the cost reflects additional provisioned-concurrency dollars). The goal is to find the minimum dollars required to make all conc values unique. Function Description The function optimizeReservedConcurrency takes the following inputs: int conc[n] : the current reserved-concurrency for each lambda int price[n] : cost to increase that lambda's limit by 1 Returns: long : the minimum dollars required to make all conc values unique Constraints 1 ≤ n ≤ 10 5 1 ≤ conc[i] ≤ 10 9 1 ≤ price[i] ≤ 10 5 Input Format