[LeetCode] Minimum Relative Loss After Buying Chocolates

1 · · Sept. 9, 2023, 7:09 a.m.
2819. Minimum Relative Loss After Buying Chocolates You are given an integer array prices, which shows the chocolate prices and a 2D integer array queries, where queries[i] = [ki, mi]. Alice and Bob went to buy some chocolates, and Alice suggested a way to pay for them, and Bob agreed. The terms for each query are as follows: If the price of a chocolate is less than or equal to ki, Bob pays for it. Otherwise, Bob pays ki of it, and Alice pays the rest. Bob wants to select exactly mi chocolate...