Leetcode 2517. Maximum Tastiness of Candy Basket
Given an array of candy prices, pick k distinct candies to maximize the minimum pairwise absolute difference (the "tastiness"). With n up to 1e5, the typical approach is to sort the prices and use binary search on the tastiness value with a greedy check to see if you can pick k prices spaced at least that far apart.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.