6min
特殊例子 ,全为负数
# -*- coding:utf-8 -*-
class Solution:
def FindGreatestSumOfSubArray(self, array):
# write code here
result=array[0] #注意特殊情况全为负数
cur=0
for i in array:
cur=max(i,i+cur)
result=max(cur,result)
return result