class Solution:
def maxSubArray(self, nums):
if nums is None or len(nums) == 0:
return 0
maxSum = nums[0]
minSum = 0
sum = 0
for num in nums:
sum += num
if sum - minSum > maxSum:
maxSum = sum - minSum
if sum < minSum:
minSum = sum
return maxSum
def maxSubArray(self, nums):
if nums is None or len(nums) == 0:
return 0
maxSum = nums[0]
minSum = 0
sum = 0
for num in nums:
sum += num
if sum - minSum > maxSum:
maxSum = sum - minSum
if sum < minSum:
minSum = sum
return maxSum
*************************
搞不懂