package
0.0.0-20241220224003-b7cf03a90b2b
Repository: https://github.com/szhou12/leetcode-go.git
Documentation: pkg.go.dev
# README
1833. Maximum Ice Cream Bars
Solution idea
Greedy Algorithm
We want to buy as many ice cream bars as possible with limited coins. Therefore, it is always optimal to buy the cheapest ice cream bar first. So greedily, we sort the ice cream bars in ascending order and keep buying them until we run out of coins.
Time complexity = $O(n\log n)$