Same Technique as Prefix Sum[Easy Peazy]
This is really a prefix sum type questions. If you are not able to understand, comment below, i\'ll try my best to help you guys out!!!\n        \n        d = d
This is really a prefix sum type questions. If you are not able to understand, comment below, i\'ll try my best to help you guys out!!!\n        \n        d = dict()\n        d[0] = -1\n        \n        cs = 0\n        totalN = 0\n        ans = 0\n        for i in range(len(nums)):\n            if nums[i] < 0:\n                totalN += 1\n            r = totalN % 2\n            if nums[i] == 0:\n                d = dict()\n                d[0] = i\n                totalN = 0\n                continue\n            if r in d:\n                ans = max(ans, i - d[r])\n            else:\n                d[r] = i\n        return ans
[]