# Leetcode 1413. Minimum Value to Get Positive Step by Step Sum

## 2. Solution

• Version 1
```class Solution:
def minStartValue(self, nums):
min_value = nums[0]
total = 0
for num in nums:
total += num
if total < min_value:
min_value = total
if min_value >= 1:
return 1
else:
return 1 - min_value```
• Version 2
```class Solution:
def minStartValue(self, nums):
min_value = 0
total = 0
for num in nums:
total += num
if total < min_value:
min_value = total
return 1 - min_value```

## Reference

1. https://leetcode.com/problems/minimum-value-to-get-positive-step-by-step-sum/

0 条评论

• ### Face_Recognition_v3a

In this assignment, you will build a face recognition system. Many of the ideas ...

• ### 重磅独家 | 腾讯AI Lab AAAI18现场陈述论文：用随机象限性消极下降算法训练L1范数约束模型

前言：腾讯 AI Lab共有12篇论文入选在美国新奥尔良举行的国际人工智能领域顶级学术会议 AAAI 2018。腾讯技术工程官方号独家编译了论文《用随机象限性消...

• ### LeetCode Weekly Contest 43解题思路

版权声明：本文为博主原创文章，未经博主允许不得转载。 https://blog.csdn.n...

• ### Tree - XGBoost with parameter description

In the previous post, we talk about a very popular Boosting algorithm - Gradient...

• ### 04.卷积神经网络 W4.特殊应用：人脸识别和神经风格转换（作业：快乐屋人脸识别+图片风格转换）

背景：04 W2 作业：Keras教程+ResNets残差网络 里的快乐的房子问题

• ### 关关的刷题日记96 – Leetcode 120. Triangle

关关的刷题日记96 – Leetcode 120. Triangle 题目 Given a triangle, find the minimum path su...

• ### 【LeetCode】45. Jump Game II

版权声明：本文为博主原创文章，遵循 CC 4.0 BY-SA 版权协议，转载请附上原文出处链接和本声明。 ...

• ### 【Leet Code】70. Climbing Stairs

版权声明：本文为博主原创文章，遵循 CC 4.0 BY-SA 版权协议，转载请附上原文出处链接和本声明。 ...