Here is my solution,

class Solution {

public:

int maxSubArray(vector<int>& nums) {

int sum = 0;

int max = INT_MIN;

for(auto i:nums){

sum = (i>(i+ sum))?i:(i+sum);

if(max < sum) max = sum;

}

return max;

}

};

Some people get 6ms solution, can any one of you post it to me?

Thanks for help