Beats 100% Other's Solutions
\nclass Solution:\n    def getMaxLen(self, nums: List[int]) -> int:\n        all_zero_ind = [ind for ind, num in enumerate(nums) if num == 0]\n        if len(al
```\nclass Solution:\n    def getMaxLen(self, nums: List[int]) -> int:\n        all_zero_ind = [ind for ind, num in enumerate(nums) if num == 0]\n        if len(all_zero_ind) == 0:\n            return self.helper(0, len(nums), nums)\n        \n        prev_ind = -1\n        ans = 0\n        for ind in all_zero_ind:\n            ans = max(ans,self.helper(prev_ind + 1, ind, nums))\n            prev_ind = ind\n            \n        ans = max(ans, self.helper(all_zero_ind[-1] + 1, len(nums), nums))\n        return ans\n            \n        \n    def helper(self, start, end, nums):\n        all_neg_ind = [ind for ind in range(start, end) if nums[ind] < 0]\n        \n        if len(all_neg_ind) % 2 == 0:\n            return end - start\n        \n        else:\n            return max(end - (all_neg_ind[0] + 1), all_neg_ind[-1] - start)\n```
['Iterator']