O(n) solution java | python | easy explained
Intuition\n- if any one is 0 all will get 0 \n- if count of neg is even they will cancel each of them we will get positive \n- if count of neg is odd it will be
# Intuition\n- if any one is 0 all will get 0 \n- if count of neg is even they will cancel each of them we will get positive \n- if count of neg is odd it will be negative \n\n# Code\n```\nclass Solution:\n    def arraySign(self, nums: List[int]) -> int:\n        neg_cnt = 0\n\n        for i in nums:\n            if(i==0):\n                return 0\n            elif(i<0):\n                neg_cnt+=1\n        \n        if(neg_cnt%2==0):\n            return 1\n        return -1\n```\n# Java \n```\nclass Solution {\n    public int arraySign(int[] nums) {\n        int cntneg = 0;\n        for(int i: nums){\n            if(i==0){\n                return 0;\n            }else if(i<0){\n                cntneg++;\n            }\n        }\n        return cntneg%2==0?1:-1;\n    }\n}\n```\n# Complexity \n- TC: O(n)\n- SC: O(1)
['Java', 'Python3']