276. 없는 숫자 더하기

김해준's avatar
Jan 15, 2026
276. 없는 숫자 더하기

사용언어 : Java

문제
notion image
풀이
/* 0 ~ 9 까지 모든 수의 합은 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 answer = 45 numbers를 순회하며 answer -= numbers[i] */ class Solution { public int solution(int[] numbers) { int answer = 45; for(var n : numbers) answer -= n; return answer; } }
notion image
Share article