Company: Factset_9oct
Difficulty: medium
Weird Pod Count Problem Description There are n microservices, where the number of running pods for the i th microservice is given by pods[i] for all 1 ≤ i ≤ n . The goal is to make the number of running pods for each microservice distinct by: Choosing any i th microservice and increasing its number of running pods by 1, at a cost of cost[i] Find the minimum possible cost to achieve this condition. Examples Example 1: Input: n = 5, pods = [5, 2, 5, 3, 1], cost = [3, 7, 8, 6, 9] Output: 9 Explanation: An optimal sequence of operations is: Choose pods[0] = 5 and increase it by 1. This operation costs 3. Now, pods = [6, 2, 5, 3, 1] . Choose pods[3] = 3 and increase it by 1. This operation costs 6. Now, pods = [6, 2, 5, 4, 1] . Hence, pods = [6, 2, 5, 4, 1] consists of distinct numbers of running pods. The total cost is 3 + 6 = 9, which is the minimum possible. Example 2: Input: pods = [8, 6, 8] cost = [9, 5, 7] Output: 7 Explanation: An optimal sequence of operations is: Choose pods