思路:动态规划
dp[i] = max(dp[i-1] + array[i], array[i])
class Solution:
def FindGreatestSumOfSubArray(self , array: List[int]) -> int:
# write code here
if len(array) == 0:
return 0
dp = [0] * len(array)
dp[0] = array[0]
for i in range(1, len(array)):
dp[i] = max(dp[i-1] + array[i], array[i])
return max(dp)