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