diff --git a/c++ code for maximum subarray sum b/c++ code for maximum subarray sum new file mode 100644 index 00000000..032870cc --- /dev/null +++ b/c++ code for maximum subarray sum @@ -0,0 +1,18 @@ +int maxSubArray(vector& nums) { + int l=nums.size(); + int max=INT_MIN; + int sum=0; + + for(int i=0;imax){ + max=sum; + } + if(sum<0){ + sum=0; + } + + } + return max; + }