solution:
std:
class Solution { public: int FindGreatestSumOfSubArray(vector<int> array) { int ans = -1e9,cnt = 0; for(int i=0;i<array.size();i++){ if(cnt <= 0) cnt = array[i]; else cnt += array[i]; ans = max(ans ,cnt); } return ans ; } };
class Solution { public: int FindGreatestSumOfSubArray(vector<int> array) { int ans = -1e9,cnt = 0; for(int i=0;i<array.size();i++){ if(cnt <= 0) cnt = array[i]; else cnt += array[i]; ans = max(ans ,cnt); } return ans ; } };