diff --git a/missing-number/donghyeon95.java b/missing-number/donghyeon95.java new file mode 100644 index 000000000..03985af52 --- /dev/null +++ b/missing-number/donghyeon95.java @@ -0,0 +1,19 @@ +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; +import java.util.stream.Collectors; + +// O(N) +class Solution { + public int missingNumber(int[] nums) { + Set numSet = Arrays.stream(nums).boxed().collect(Collectors.toSet()); + + for (int i=0; i