- 난이도: Lv1
프로그래머스 링크: https://school.programmers.co.kr/learn/courses/30/lessons/131705
풀이 링크(GitHub): hayannn/CodingTest_Java/프로그래머스/1/131705. 삼총사
풀이 시간 : 15분
import java.util.*;
class Solution {
public int solution(int[] number) {
int answer = 0;
for(int one = 0; one < number.length; one++) {
for(int two = one + 1; two < number.length; two++) {
for(int three = two + 1; three < number.length; three++) {
if(number[one] + number[two] + number[three] == 0) {
answer++;
}
}
}
}
return answer;
}
}