Python O(n) time, O(1) space
Intuition: \n\nWe track the maximum length of positive/negative product ending at the ith element.\n\nExample:\n\n\t\t\t\t1 2 -5 -3 -2\npositive len:   1 2  0  
Intuition: \n\nWe track the maximum length of positive/negative product ending at the ith element.\n\nExample:\n```\n\t\t\t\t1 2 -5 -3 -2\npositive len:   1 2  0  4  2\nnegative len:   0 0  3  1  5\n```\n\nif we encounter 0, just reset positive len & negative len\n\n```python\nclass Solution:\n    def getMaxLen(self, nums: List[int]) -> int:\n        """\n        positive product => all positives or even count of negative numbers\n        """\n        ans = 0\n        positive_len, negative_len = 0, 0  # maximum lengh of positive/negative product ending at ith element\n        for n in nums:\n            if n > 0:\n                positive_len, negative_len = positive_len+1, negative_len + 1 if negative_len > 0 else 0\n            elif n < 0:\n                positive_len, negative_len = negative_len+1 if negative_len > 0 else 0, positive_len + 1 if positive_len > 0 else 1\n            else: \n                positive_len, negative_len = 0, 0\n            ans = max(ans, positive_len)\n        return ans\n        \n```
['Dynamic Programming']