1833. Maximum Ice Cream Bars

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 1833

class Solution:
    def maxIceCream(self, costs: List[int], coins: int) -> int:
        costs.sort()
        for i, c in enumerate(costs):
            if coins < c:
                return i
            coins -= c
        return len(costs)