标签:imu return span div youtube class integer bsp sub
53 Maximum Subarray https://www.youtube.com/watch?v=7J5rs56JBs8 class Solution { public int maxSubArray(int[] nums) { int[] result = new int[nums.length]; result[0] = nums[0]; for(int i = 1; i < nums.length; i++){ result[i] = result[i-1] > 0 ? result[i-1] + nums[i] : nums[i]; } int max = Integer.MIN_VALUE; for(int i = 0; i < nums.length; i++){ max = Math.max(result[i], max); } return max; } }
标签:imu return span div youtube class integer bsp sub
原文地址:https://www.cnblogs.com/tobeabetterpig/p/9454838.html