Leetcode 1514 Solution
This article provides solution to leetcode question 1514 (minimum-value-to-get-positive-step-by-step-sum)
Access this page by simply typing in "lcs 1514" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
https://leetcode.com/problems/minimum-value-to-get-positive-step-by-step-sum
Solution
class Solution:
def minStartValue(self, nums: List[int]) -> int:
min_sum = 0
s = 0
for num in nums:
s += num
min_sum = min(s, min_sum)
return 1 - min_sum