Python 3 || Solution (faster than 79%)
\nclass Solution:\n    def getMaxLen(self, nums: List[int]) -> int:\n        positive = negative = 0\n        result = 0\n        for n in nums:\n            if
```\nclass Solution:\n    def getMaxLen(self, nums: List[int]) -> int:\n        positive = negative = 0\n        result = 0\n        for n in nums:\n            if n == 0:\n                positive = 0\n                negative = 0\n            elif n > 0:\n                positive += 1\n                negative = 0 if negative == 0 else negative+1\n            else:\n                temp = positive\n                positive = 0 if negative == 0 else negative+1\n                negative = temp + 1\n            result = max(result, positive)\n        return result\n```\n![image](https://assets.leetcode.com/users/images/3b5e07be-8482-4c97-89f1-07a19b735f8e_1631723876.2856855.png)\n*Thanks to harin_mehta for the explanations*
['Python']