We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 035652f commit 5cccae6Copy full SHA for 5cccae6
medium/missing_numbers.java
@@ -0,0 +1,12 @@
1
+import java.util.*;
2
+
3
+class Program {
4
+ public int[] missingNumbers(int[] nums) {
5
+ Set<Integer> set = new HashSet<>();
6
+ for(int i = 1; i<= nums.length+2;i++) set.add(i);
7
+ for(int num:nums) set.remove(num);
8
+ List<Integer> list = new ArrayList<>(set);
9
+ return new int[]{list.get(0),list.get(1)};
10
+ }
11
+}
12
0 commit comments