JAVA_LeetCode 1822_Sign of the Product of an Array 풀이 class Solution { public int arraySign(int[] nums) { // 음양수 여부에 맞춰 1 또는 -1을 곱해준다. int res = 1; for(int num : nums){ if(num == 0) return 0; res *= (num > 0 ? 1 : -1); } return res; } } * 출처 https://leetcode.com/problems/sign-of-the-product-of-an-array...
JAVA_LeetCode 1822_Sign of the Product of an Array에 대한 요약내용입니다.
자세한 내용은 아래에 원문링크를 확인해주시기 바랍니다.