C++ ||  MOST OPTIMIZED || EASY TO UNDERSTAND
If element 0 found than return 0;\nkeep a track for negative element \nif negative elements are odd return -1\nelse return 1;\n\n# Complexity\n- Time complexity
If element 0 found than return 0;\nkeep a track for negative element \nif negative elements are odd return -1\nelse return 1;\n\n# Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\n(1)\n\n# Code\n```\nclass Solution {\npublic:\n    int arraySign(vector<int>& nums) {\n        int x = 0;\n        for(auto &i: nums){\n            if(i<0)x ^= 1;\n            else if(i==0)return 0;\n        }\n        if(x)return -1;\n        return 1;\n    }\n};\n```
['C++']