[C++] Simplest solution, 74ms beats 100%.
Intuition\n\nSimilar to Maximum Product Subarray, with some minor tweaks.\n\nExplanation\n\nAs you iterate through nums:\n\n Store the lengths of the (locally) 
**Intuition**\n\nSimilar to [Maximum Product Subarray](https://leetcode.com/problems/maximum-product-subarray/discuss/48230/Possibly-simplest-solution-with-O(n)-time-complexity), with some minor tweaks.\n\n**Explanation**\n\nAs you iterate through `nums`:\n\n* Store the lengths of the (locally) longest subarrays with a positive and negative product, into `posLen` and `negLen` respectively.\n* If you encounter a zero, reset these lengths.\n* If you encounter a negative value, swap these lengths.\n\nFind the max over all iterations of `posLen`.\n\n**Complexity**\n\nTime: `O(n)`, Space: `O(1)`.\n\n```\nint getMaxLen(vector<int>& nums) {\n    int posLen = 0, negLen = 0, maxLen = 0;\n\tfor (int i : nums) {\n\t\tif (i == 0) posLen = 0, negLen = 0;\n\t\telse {\n\t\t\tif (i < 0) swap(posLen, negLen);\n\t\t\tif (posLen > 0 || i > 0) ++posLen;\n\t\t\tif (negLen > 0 || i < 0) ++negLen;\n\t\t\tmaxLen = max(maxLen, posLen);\n\t\t}\n\t}\n\treturn maxLen;\n}\n```
['Array', 'Dynamic Programming', 'C++']