[C++] Kadane's Modified Version
Idea: If 0 arrives, the current length will be reset to 0. If a negative number arrives, we check if one negative number arrived earlier or not, if it arrived, 
**Idea:** If 0 arrives, the current length will be reset to 0. If a negative number arrives, we check if one negative number arrived earlier or not, if it arrived, we add the current negative number to our length. Otherwise we store the current length in a variable and reset current length to 0 so that if a negative arrives in future, we can add this stored length to the total length.\n```\nint solve(vector<int> nums){\n        int history = 0, maxLen = 0, curLen = 0;\n        for(int i: nums){\n            if(i > 0)\n                curLen++;\n            else if(!i){\n                curLen = 0;\n                history = 0;\n            }\n            else{                            // if the number is negative\n                if(history != 0){            // there was one negative number earlier, now we can take it in our subarray\n                    curLen += (history + 1);\n                    history = 0;     \n                }\n                else{               \n                    history = curLen + 1;   // store the current length\n                    curLen = 0;             // as we can\'t consider a single negative number\n                }\n            }\n            maxLen = max(maxLen, curLen);\n        }\n        return maxLen;\n    }\n    \n    int getMaxLen(vector<int>& nums) {\n        int a = solve(nums);\n\t\t/* \n\t\tSince we have the option to choose either first 2 negatives or the last two negtives\n\t\tin case there are a total of three negatives, so to consider these types of situations, \n\t\twe also check the max len subarray by reversing the array.\n\t\t*/\n        reverse(nums.begin(), nums.end());\n        int b = solve(nums);\n        return max(a,b);\n    }\n```
[]