标签:span public += mat bsp pre turn subarray sub
class Solution { public int maxSubArray(int[] nums) { int ans = nums[0]; int sum = 0; for(int num: nums) { if(sum > 0) { sum += num; } else { sum = num; } ans = Math.max(ans, sum); } return ans; } }
标签:span public += mat bsp pre turn subarray sub
原文地址:https://www.cnblogs.com/z2529827226/p/11725537.html