✅Beats 100%  ✅0ms - Java - Users ✅Beginner  Friendly
Intuition\nIn Question it is given that if the product of all the array integer\nGives \n    Negative value Return -1\n    Positive value Return 1\n    0 Return
# Intuition\nIn Question it is given that if the product of all the array integer\nGives \n    *Negative value* **Return -1**\n    *Positive value* **Return 1**\n    *0* **Return 0**\n\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nTake one int variable to count number of negative values\n\nTake one for loop to iterate through array\n\nIf we found any element which is equels to **0**\n**Return 0** because anything multiplyed by 0 gives 0.\n\nAfter completion of for loop check the *c* varible is **odd** or **even**\nIf odd **Return -1** because multiplication of negative values for odd times gives negative value\n\nelse **Return 1**\n# Complexity\n- Time complexity:\n- O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n- 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 c=0;\n        for (int i: nums)\n        {\n            if (i==0)\n                return 0;\n            else if(i<0)\n                c++;\n        }\n        if (c%2==0)\n            return 1;\n        else \n            return -1;\n    }\n}\n```
['Java']