Company: De_shaw_16_dec
Difficulty: medium
Minimize Cost Difference body { font-family: sans-serif; line-height: 1.6; } h1, h2, h3 { border-bottom: 1px solid #ccc; padding-bottom: 5px; } code { background-color: #f4f4f4; padding: 2px 4px; border-radius: 4px; font-family: monospace; } pre { background-color: #f4f4f4; padding: 10px; border-radius: 4px; white-space: pre-wrap; } 1. Minimize Cost Difference There are n items in a shop, where the cost of the i th item is represented by cost[i] . The shopkeeper wants to normalize the cost of the items, i.e., decrease the cost difference between the items with maximum and minimum costs. But, the shopkeeper cannot change the cost of the items suddenly as it will affect the reputation of the shop. The shopkeeper can choose to do one of the following operations for each of the m days: Decrease the cost of the item with maximum cost by 1. Increase the cost of the item with minimum cost by 1. Note: If there are multiple items with minimum or maximum cost in the array, only one item's cost c