-Code
class Solution {
public int solution(int[] absolutes, boolean[] signs) {
int answer = 0;
for (int i = 0; i < absolutes.length; i++) {
answer += signs[i] ? absolutes[i] : -absolutes[i];
}
return answer;
}
}
'Beakjoon&프로그래머스 > Java' 카테고리의 다른 글
[프로그래머스/Java] 서울에서 김서방 찾기 (0) | 2025.02.24 |
---|---|
[프로그래머스/Java] 나누어 떨어지는 숫자 배열 (0) | 2025.02.24 |
[프로그래머스/Java] 하샤드 수 (0) | 2025.02.23 |
[프로그래머스/Java] 정수 제곱근 판별 (0) | 2025.02.23 |
[프로그래머스/Java] 정수 내림차순으로 배치하기 (0) | 2025.02.23 |