class Solution { public: int FindGreatestSumOfSubArray(vector array) { //求连续子数组的最大值 int max=-9999; int count=0; for(int i=0;i<array.size();i++) { count+=array[i]; if(count>max) max=count; if(count<0) count=0; } max=count>max&&count!=0?count:max; return max; } };