AmazonOA #73
Min Operations (Bring Price Range Below d)
Estimated HardStatement and editorial — judging is being prepared
Topics (AI-labelled)Binary SearchGreedy
Given prices[n], integers k and d. Each op picks two indices (x, y) and a p ≤ k, then prices[x] += p, prices[y] -= p. Make max - min < d with minimum ops.
Constraints
1 ≤ n ≤ 10⁵1 ≤ prices[i] ≤ 10⁹1 ≤ k ≤ 10⁹2 ≤ d ≤ 10⁹
Editorial
Loading solution…