We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents e863fa4 + 56d6a94 commit eeee241Copy full SHA for eeee241
java/1822-sign-of-the-product-of-an-array.java
@@ -0,0 +1,10 @@
1
+class Solution {
2
+ public int arraySign(int[] nums) {
3
+ int sign = 1;
4
+ for (int i : nums) {
5
+ if (i == 0) return 0;
6
+ if (i < 0) sign *= -1;
7
+ }
8
+ return sign;
9
10
+}
0 commit comments