Search
⌘K

Leetcode 1833. Maximum Ice Cream Bars

Given a list of ice-cream prices and a budget, maximize the number of bars you can buy by greedily taking the cheapest items first. Because costs are bounded, use counting sort (a frequency array) to iterate prices in ascending order efficiently and accumulate purchases until the coins run out.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Your account is free and you can post anonymously if you choose.