Very easy C++ solution
\nint getMaxLen(vector<int>& nums) {\n        int n= nums.size();\n        long long int pro= 1;\n        int j = -1,maxi=0;\n        for(int i=0; i<n; i++)\n  
```\nint getMaxLen(vector<int>& nums) {\n        int n= nums.size();\n        long long int pro= 1;\n        int j = -1,maxi=0;\n        for(int i=0; i<n; i++)\n        {\n            pro*= nums[i];\n            if(pro>0)\n            {\n                maxi = max(maxi,i-j);\n                pro = 1;\n            }\n            if(pro<0)\n                pro = -1;\n            if(pro== 0)\n            {\n                pro= 1;\n                j = i;\n            }\n        }\n        pro= 1;\n        j = n;\n        for(int i=n-1; i>=0; i--)\n        {\n            pro*= nums[i];\n            if(pro>0)\n            {\n                maxi = max(maxi,j-i);\n                pro = 1;\n            }\n            if(pro<0)\n                pro = -1;\n            if(pro== 0)\n            {\n                pro= 1;\n                j = i;\n            }\n        }\n        return maxi;\n    }\n```\nIF YOU LIKE THE CODE, DO UPVOTE.
['C']