Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 2144. Minimum Cost of Buying Candies With Discount
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).
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.