6 line simple C++ solution


#1
int curr=0,res = INT_MIN;
for(int i=0; i < A.size();i++) {
    if(A[i] > curr + A[i])  curr = A[i];
    else curr += A[i];
    res = max(res,curr);
} 

return res;