My Simple C++ Solution

  • 1

    This was the solution I thought of, if there are any improvements you can suggest then please let me know. I am still a beginner and there is so much to know, thanks!

    int maxSubArray(vector<int>& nums) {
            int currSum = 0;
            int maxSum = INT_MIN;
            for(int i=0; i<nums.size();i++){
                    currSum =;
                    maxSum = currSum;
            return maxSum;

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.