Skip to main content

1413. Minimum Value to Get Possitive Sum

Python

class Solution:
def minStartValue(self, nums: List[int]) -> int:
totals = []
total = 0

for num in nums:
total += num
totals.append(total)

if (min_total := min(totals)) < 1:
return 1 - min_total
else:
return 1