leetcode53 python3 96ms 最大子序列和 python解法
class Solution:
def maxSubArray(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
curr = nums[0]
res = nums[0]
# 当前子序列和只有在curr>0的时候才会更新
for num in nums[1:]:
curr = max(curr + num, num)
res = max(res, curr)
return res