Easy C++ Solution
Intuition\n Describe your first thoughts on how to solve this problem. \nJust find the count of negative numbers. If the count is even , that means all the minu
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nJust find the count of negative numbers. If the count is even , that means all the minus signs will cancel out each other and product will be postive otherwise negative.\n# Approach\n<!-- Describe your approach to solving the problem. -->\nfirstly, if any number is 0 then product will be 0 so check for that first and no need to proceed further as we already encountered 0 final answer will also be 0 only.\nthen, \nIf count(negativeNumbers) is even, then return 1 otherwise return -1.\n# Complexity\n- Time complexity : O(N)\n- Space complexity : O(1) \n# Code\n```\nclass Solution {\npublic:\n    int arraySign(vector<int>& nums) {\n        int n = nums.size(), negativecount = 0;\n        for(int i=0;i<n;i++)\n        {\n          if(nums[i]==0)\n          return 0;\n          else if(nums[i]<0)\n          negativecount++;\n        }\n        return negativecount%2 ? -1 : 1;\n    }\n};\n```
['C++']