프로그래머스-없는 숫자 더하기

이호영·2022년 4월 5일
0

프로그래머스-Level.1

목록 보기
11/14
class Solution {
    public int solution(int[] numbers) {
        int ans=45;
        int[] num={0,1,2,3,4,5,6,7,8,9};
        for(int i=0; i<numbers.length; i++){
            for(int j=0; j<num.length; j++){
                if(numbers[i] == num[j]){
                    ans-=num[j];
                }
            }
        }
        return ans;
    }
}

0개의 댓글