diff --git a/E_1822_SignoftheProductofanArray.java b/E_1822_SignoftheProductofanArray.java new file mode 100644 index 0000000..0aafc0c --- /dev/null +++ b/E_1822_SignoftheProductofanArray.java @@ -0,0 +1,12 @@ +class Solution { + public int arraySign(int[] nums) { + int ret=1; + for (int num: nums){ + if(num==0) + return 0; + if(num<0) + ret= -ret; + } + return ret; + } +} \ No newline at end of file