JAVA || 2 Methods
METHOD1:\n\nclass Solution {\n    public int arraySign(int[] nums) {\n        int prod=1;\n        for(int i=0;i<nums.length;i++){\n            int val=signFunc
**METHOD1:**\n```\nclass Solution {\n    public int arraySign(int[] nums) {\n        int prod=1;\n        for(int i=0;i<nums.length;i++){\n            int val=signFunc(nums[i]);\n            prod*=val;\n        }\n        return prod;\n    }\n    \n    private int signFunc(int x){\n        if(x<0) return -1;\n        else if(x>0) return 1;\n        return 0;\n    }\n}\n```\n\n**Method2:**\nwe can see that answer is going to be 1,-1 or 0 .\nwe just need to flip values when we encountered a negative value.\n```\n  public int arraySign(int[] nums) {\n        int prod=1;\n        for(int num:nums){\n            if(num<0) prod=-prod;\n            else if(num==0) return 0; \n        }\n        return prod;\n    }\n```\n\nComplexity:\n`Time:O(n) and Space:O(1)` in both methods\n\nPlease **UPVOTE** if found it helpful and feel free to reach out to me or comment down if you have any doubt.
['Java']