【題目敘述】https://leetcode.com/problems/maximum-subarray/
class Solution(object):
def maxSubArray(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
total = 0
maxi = nums[0]
for num in nums:
total += num
if total > maxi:
maxi = total
if total < 0:
total = 0
return maxi