Company: Amazon_24feb
Difficulty: medium
With Amazon's new innovative OptiResource Kit users can effortlessly optimize the arrangement of their resource pools. This kit is designed to minimize the overall cost needed for efficient allocation. The process starts with an array of resources, and the objective is to reduce the total cost required. The cost is the sum of costs needed for each resource. Formally, given an array cost of size m , utilizing the OptiResource Kit, users can perform operations on the array. In each operation, the user chooses 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] ). When this condition is satisfied, the cost of resource x can be updated to equal the cost of resource y . This operation can be repeated as many times as possible, on different resources or positions. 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