Available question text
Given candy prices and a "buy two get one free" rule where the free candy must be no more expensive than the cheaper purchased candy, minimize the total cost by greedily choosing which candies to pay for. The key is to sort prices and in each group of three pay for the two most expensive (making the third free).
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 2144. Minimum Cost of Buying Candies With Discount
Interview date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source