C# solution (DP)
Intuition\n\n\n\n\n\nComplexity\n- Time: O(n)\n- Space: O(1)\n\nImplementation\n\npublic class Solution {\n    public int GetMaxLen(int[] nums) {\n        \n   
**Intuition**\n![image](https://assets.leetcode.com/users/images/fb9c725b-e9cc-44d7-931a-3c969deec0cf_1649545456.0309038.png)\n\n\n\n\n**Complexity**\n- Time: O(n)\n- Space: O(1)\n\n**Implementation**\n```\npublic class Solution {\n    public int GetMaxLen(int[] nums) {\n        \n        if(nums == null || nums.Length == 0)\n            return 0;\n        \n        int positive = 0, negative = 0, res = 0;\n        foreach(var num in nums)\n        {\n            if(num == 0)\n            {\n                positive = 0;\n                negative = 0;\n            }\n            else if(num > 0)\n            {\n                positive++;\n                negative = negative == 0? 0 : negative + 1;\n            }\n            else\n            {              \n                int prevPositive = positive;\n                positive = negative == 0? 0 : negative + 1;\n                negative = prevPositive + 1;\n            }\n            \n            res = Math.Max(res, positive);\n        }\n        \n        return res;\n    }\n}\n```
[]