Minimum Value to Get Positive Step by Step Sum LeetCode solution in Python

1
# Runtime: 42 ms (Top 60.3%) | Memory: 16.30 MB (Top 27.0%)
2

3

4
class Solution:
5
def minStartValue(self, nums: List[int]) -> int:
6
return max(1, 1 - min(accumulate(nums)))

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0