Skip to content

Commit a900a18

Browse files
committed
Q1822 added.
1 parent 511dd93 commit a900a18

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

E_1822_SignoftheProductofanArray.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Solution {
2+
public int arraySign(int[] nums) {
3+
int ret=1;
4+
for (int num: nums){
5+
if(num==0)
6+
return 0;
7+
if(num<0)
8+
ret= -ret;
9+
}
10+
return ret;
11+
}
12+
}

0 commit comments

Comments
 (0)