✅ Easy Java solution || using iteration 🏆 || Beginner Friendly 🔥
Intuition\nIn Multiplciation\n1. If any element is 0, multiplication is 0\n2. if number if negative element are odd, multiplication is negative\n3. multiplicati
# Intuition\nIn Multiplciation\n1. If any element is 0, multiplication is 0\n2. if number if negative element are odd, multiplication is negative\n3. multiplication is positive in other case\n\n# Approach\n1. Count number of negative elements\n2. If you see 0 while traversing, return 0 immediately\n3. At the end if number of negative numbers is odd, return -1 else return 1 \n\n# Complexity\n- Time complexity:$$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:$$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int arraySign(int[] nums) {\n        int negativeCount = 0;\n        for(int num : nums) {\n            if(num == 0) {\n                return 0;\n            } else if( num < 0) {\n                negativeCount++;\n            }\n        }\n\n        if(negativeCount % 2 == 1) {\n            return -1;\n        }\n        return 1;\n    }\n}\n```
['Java']