题解 | #连续子数组的最大和#
连续子数组的最大和
https://www.nowcoder.com/practice/459bd355da1549fa8a49e350bf3df484
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param array int整型一维数组 # @return int整型 # class Solution: def FindGreatestSumOfSubArray(self , array: List[int]) -> int: # write code here def maxsumkid(l): dp=[l[0] for i in range(len(l))] for i in range(len(l)): if i!=0: dp[i]=max(l[i],dp[i-1]+l[i]) return max(dp) return maxsumkid(array)