class Solution(object):

def maxSubArray(self, nums):

"""

:type nums: List[int]

:rtype: int

"""

maxSum=nums[0]

numSum=nums[0]

```
for i in range(len(nums)-1):
if numSum>0:
numSum+=nums[i+1]
else:
numSum=nums[i+1]
maxSum=max(maxSum,numSum)
return maxSum
```