1798. Maximum Number of Consecutive Values You Can Make

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

On This Page

LeetCode problem 1798

class Solution:
    def getMaximumConsecutive(self, coins: List[int]) -> int:
        res = 1
        for v in sorted(coins):
            if v > res:
                break
            res += v
        return res