题解 | #连续子数组的最大和#
连续子数组的最大和
https://www.nowcoder.com/practice/459bd355da1549fa8a49e350bf3df484
function FindGreatestSumOfSubArray(array) { // write code here let max = array[0] function maxArray(i) { if (i === 0) return array[0] const result = Math.max(maxArray(i - 1) + array[i], array[i]) max = max < result ? result : max return result } maxArray(array.length - 1) return max } module.exports = { FindGreatestSumOfSubArray : FindGreatestSumOfSubArray };