Company: Amazon_24feb
Difficulty: medium
A cloud platform's new OptiResource Kit lets users effortlessly rebalance their resource pools, aiming to bring the total allocation cost down as low as possible. You start with an array of resource costs, and the goal is to shrink the sum of these costs as much as you can. The overall cost is just the sum across all the resources. Formally, given an array cost of size m , the OptiResource Kit lets users repeatedly apply an operation on this array. In each operation, the user picks two positions x and y such that the cost of the resource at position x ( cost[x] ) is divisible by the cost of the resource at position y ( cost[y] ). Whenever that holds, the cost at position x can be overwritten with the cost at position y . This operation can be applied any number of times, on any positions that satisfy the condition. An integer x is divisible by another integer y if x can be divided by y exactly, with nothing left over, for example, 6 is divisible by 3, while 7 is not. Find the minimum t