Problem 2517 · Medium

Maximum Tastiness of Candy Basket

Binary search the answer gap and check each candidate with a greedy pick over the sorted prices.

Open the interactive visualisation