문제풀이 2021 04 22
2021.04.22 연습
- 사용언어 : java
class Solution {
public int arraySign(int[] nums) {
int cnt = 1;
for (int i = 0; i < nums.length ; i++ ) {
if (nums[i] == 0) {
return 0;
} else if (nums[i] < 0){
cnt *= -1;
}
}
return cnt;
}
}
Runtime: 0 ms, faster than 100.00% of Java online submissions for Sign of the Product of an Array. Memory Usage: 38.2 MB, less than 94.95% of Java online submissions for Sign of the Product of an Array.