Company: Amazon_july
Difficulty: medium
Minimum Operations to Adjust Prices Problem Description A regional distribution center is re-pricing its catalogue. There are n products, and the current price of the i th product is prices[i] . You are also given two integers: k — the maximum amount by which a single product's price can be changed in one operation, and d — a target gap. Your goal is to make the difference between the highest and the lowest price in the catalogue strictly less than d . To adjust the prices, you may repeat the following operation any number of times: Choose two indices x and y ( 1 ≤ x, y ≤ n ) and an integer p ( 1 ≤ p ≤ k ). Increase the price of product x by p . Decrease the price of product y by p . Note that a single operation raises one price and lowers another by the same amount p , so the total of all prices never changes. Given n , the array prices , and the integers k and d , return the minimum number of operations required so that the difference between the largest and t