✅Easiest Basic Cpp/Java/Python Solution | With Explanation 🏆
1.C++  : \n\nclass Solution {\npublic:\n    int arraySign(vector<int>& nums) {\n        int product_sign=1;\n        \n        for(size_t i=0;i<nums.size();i++)
**1.C++  :** \n```\nclass Solution {\npublic:\n    int arraySign(vector<int>& nums) {\n        int product_sign=1;\n        \n        for(size_t i=0;i<nums.size();i++)\n        {\n            if(nums[i]==0)\n            {\n                return 0;\n            }\n            if(nums[i]<0)    //we need not to find product..just check sign of every iteratin element\n            {\n                product_sign*=-1;\n            }\n        }\n        if(product_sign>0)\n            return 1;\n        else \n            return -1;\n        \n    }\n};\n```\n**2. Java :**\n```\nclass Solution {\n    public int arraySign(int[] nums) {\n        int productSign = 1;\n\n        for (int num : nums) {\n            if (num == 0) {\n                return 0;\n            }\n            if (num < 0) {\n                productSign *= -1;\n            }\n        }\n\n        if (productSign > 0)\n            return 1;\n        else \n            return -1;\n    }\n}\n```\n\n**3. Python3  :**\n```\nclass Solution:\n    def arraySign(self, nums: List[int]) -> int:\n        product_sign = 1\n\n        for num in nums:\n            if num == 0:\n                return 0\n            if num < 0:\n                product_sign *= -1\n\n        if product_sign > 0:\n            return 1\n        else:\n            return -1\n```\n\n### Explanation :\nInitialize product as 1.\nIterate through the elements of the nums array.\nFor each element num:\n1 If num is zero, return 0 (since any multiplication by zero results in zero).\n2 If num is negative, multiply product by -1.\n3 After iterating through all elements, the sign of product is determined:\n4 If product is greater than 0, return 1 (positive sign).\n5 If product is less than 0, return -1 (negative sign).\n\nNote...we dont need to find the product of array elements..\nwhen we iterate throught loop...every element sign is checked...if negetive sign occuspdt_sign is set to negative..else positive
['Array', 'Math', 'C', 'Python', 'Java', 'Python3']