Skip to content

Latest commit

ย 

History

History
25 lines (23 loc) ยท 646 Bytes

File metadata and controls

25 lines (23 loc) ยท 646 Bytes

ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค Level1 : ์‚ผ์ด์‚ฌ

class Solution {
    public int solution(int[] number) {
        int answer = 0;
        int n = number.length; //ํ•™์ƒ์ˆ˜
        int sum = 0;
        for(int i=0; i<=n-2; i++){
            for(int j=i+1; j<=n-1; j++){
                for(int k=j+1; k<n; k++){
                    sum = number[i]+number[j]+number[k];
                    if(sum==0){
                        answer++;      
                    }
                    sum = 0;
                }
            }
        }
        return answer;
    }
}