알고리즘/프로그래머스
[프로그래머스] 음양 더하기
송민준
2022. 4. 24. 13:23
https://programmers.co.kr/learn/courses/30/lessons/76501?language=java
class Solution {
public int solution(int[] absolutes, boolean[] signs) {
int result = 0;
for(int i = 0; i < absolutes.length; i++) {
result += absolutes[i] * (signs[i] ? 1 : -1);
}
return result;
}
}