public class Solution {
public int FindGreatestSumOfSubArray(int[] array) {
int [] newchar = new int [array.length];
newchar[0]=array[0];
int max=newchar[0];
for(int i=1;i<array.length;i++){
newchar[i]=Math.max(array[i],array[i]+newchar[i-1]);
max=newchar[i]>max?newchar[i]:max;
}
return max;
}
}
网友评论