2022-10-07-1800-最大升序子数组和

1 · zhuba-Ahhh · Oct. 7, 2022, 2:43 a.m.
1800.最大升序子数组和模拟 / dpJS123456789101112var maxAscendingSum = function(nums) { let max = nums[0], sum = nums[0]; for (let i = 0; i < nums.length; i++) { if (nums[i] < nums[i + 1]) { sum += nums[i + 1]; max = max > sum ? max : sum; } else { sum = nums[i + 1]; } } var maxAscendingSum = function(nums) { let max = nums[0], sum = nums[0]; for (let i = 0; i < nums.length; i++) { if (nums[i] < nums[i + 1]) { sum += ...