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

박철현·2023년 3월 13일

프로그래머스

목록 보기
6/80

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

class Solution {
    public int solution(int[] numbers) {
        int sum=0;
        int temp = 0;
        
        for(int j=0; j<=9; j++)
            temp +=j;
        
        for(int i=0; i<numbers.length ; i++)
        {
            sum += numbers[i];
        }
            
        return temp - sum;
    }
}
profile
비슷한 어려움을 겪는 누군가에게 도움이 되길

0개의 댓글