连续子数组的最大和
2019-12-16 本文已影响0人
而立之年的技术控

class Solution:
def FindGreatestSumOfSubArray(self, array):
# write code here
max = None
tmp = 0
for i in array:
if max == None:
max = i
if tmp + i < i:
tmp = i
else:
tmp = tmp+i
if max < tmp:
max = tmp
return max