Skip to content

Commit

Permalink
없는 숫자 더하기 - level1
Browse files Browse the repository at this point in the history
  • Loading branch information
sey2 authored Aug 15, 2022
1 parent d93293a commit 23c76fd
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions programmers/AddNumber.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import java.util.*;
class Solution {
public static int solution(int[] numbers) {
boolean check[] = new boolean[10];


for(int i=0; i<numbers.length; i++)
check[numbers[i]] = true;

int answer = 0;

for(int i=1; i<check.length; i++){
if(check[i] == true) continue;
answer += i;
}

return answer;
}
}

0 comments on commit 23c76fd

Please sign in to comment.