[Java] Concise Solution || O(1) space O(n) time
112 / 112 test cases passed.\nStatus: Accepted\nRuntime: 3 ms\nMemory Usage: 55.7 MB\n\n\nclass Solution {\n    public int getMaxLen(int[] nums) {\n        int 
**112 / 112 test cases passed.\nStatus: Accepted\nRuntime: 3 ms\nMemory Usage: 55.7 MB**\n\n```\nclass Solution {\n    public int getMaxLen(int[] nums) {\n        int positive = 0;\n        int negative = 0;\n        int res = 0;\n        \n        for(int i = 0;i< nums.length;i++){\n            int temp = nums[i];\n            \n            if(temp == 0){\n                positive = 0;\n                negative = 0;\n            }else if(temp > 0){\n                positive++;\n                negative = negative == 0 ? 0 : negative+1;\n            }else{\n                int x = positive;\n                positive = negative == 0 ? 0 : negative + 1;\n                negative = x + 1;\n            }\n            \n            res = Math.max(res,positive);\n        }\n        \n        return res;\n    }\n}\n```
['Java']