标签:
public class Solution {
public int maxSubArray(int[] nums) {
int res = -1000000;
int sum=0;
for(int i=0; i<nums.length; i++){
sum += nums[i];
if(sum > res){
res = sum;
}
if(sum < 0){
sum = 0;
}
}
return res;
}
}
标签:
原文地址:http://www.cnblogs.com/LiaLialu/p/5903328.html