class Solution {
public:
int FindGreatestSumOfSubArray(vector<int>array) {
int sum = array[0];
int maxsum = array[0];
for(int i = 1;i<array.size();i++){
sum = sum + array[i];
if(sum < array[i])
sum = array[i];
if(sum >= maxsum)
maxsum = sum;
}
return maxsum;
}
};
class Solution {
public:
int FindGreatestSumOfSubArray(vector<int>array) {
if(array.size()==0)
return0;
int dp[array.size()];
dp[0]=array[0];
int result=array[0];
for(int i=1;i<array.size();i++)
{
dp[i]=max(array[i],dp[i-1]+array[i]);
result=max(result,dp[i]);
}
return result;
}
};
class Solution {public: int FindGreatestSumOfSubArray(vector<int> array) { int sum = array[0]; int maxsum = array[0]; for(int i = 1;i<array.size();i++){ sum = s