题解 | #子数组的最大累加和问题#
子数组的最大累加和问题
http://www.nowcoder.com/practice/554aa508dd5d4fefbf0f86e5fe953abd
class Solution:
def maxsumofSubarray(self , arr ):
s = 0
res = []
for i in arr:
s += i
if s >= 0:
res.append(s)
else:
s = 0
res = []
return max(res)