题解 | #连续子数组的最大和#
连续子数组的最大和
http://www.nowcoder.com/practice/459bd355da1549fa8a49e350bf3df484
class Solution { public: int FindGreatestSumOfSubArray(vector<int> array) { int res = array[0]; for(int i=1;i<array.size();i++) { array[i]=max(array[i-1]+array[i], array[i]); if(array[i]>res) res=array[i]; } return res; } };