Skip to content

Commit c35127b

Browse files
committedJul 10, 2023
Update: 1822 - Sign of the Product of an Array
1 parent 128e9fe commit c35127b

3 files changed

+3
-3
lines changed
 

‎javascript/1822-sign-of-the-product-of-an-array.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const arraySign = function (nums) {
33

44
for (const num of nums) {
55
if (num == 0) return 0;
6-
else if (num < 0) sign = -1 * sign;
6+
if (num < 0) sign = -1 * sign;
77
}
88

99
return sign;

‎python/1822-sign-of-the-product-of-an-array.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def arraySign(self, nums: List[int]) -> int:
88
for num in nums:
99
if num == 0:
1010
return 0
11-
elif num < 0:
11+
if num < 0:
1212
sign = -1 * sign
1313

1414
return sign

‎typescript/1822-sign-of-the-product-of-an-array.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ function arraySign(nums: number[]): number {
33

44
for (const num of nums) {
55
if (num == 0) return 0;
6-
else if (num < 0) sign = -1 * sign;
6+
if (num < 0) sign = -1 * sign;
77
}
88

99
return sign;

0 commit comments

Comments
 (0)
Please sign in to comment.