1413. Minimum Value to Get Positive Step by Step Sum

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

On This Page

LeetCode problem 1413

class Solution:
    def minStartValue(self, nums: List[int]) -> int:
        s = list(accumulate(nums))
        return 1 if min(s) >= 0 else abs(min(s)) + 1