```
class Solution {
public:
int maxSubArray(vector<int>& nums) {
int sum=0x80000000,max=0x80000000;
for(auto i:nums){
max=sum>max?sum:max;
if(sum<0){
sum=sum>i?sum:i;
continue;
}
sum=sum+i>0?sum+i:0;
}
return max>sum?max:sum;
}
};
```