We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 97911b7 commit 6ef9db5Copy full SHA for 6ef9db5
missing-number/gitsunmin.ts
@@ -0,0 +1,12 @@
1
+/**
2
+ * https://leetcode.com/problems/missing-number
3
+ * time complexity : O(n)
4
+ * space complexity : O(n)
5
+ */
6
+function missingNumber(nums: number[]): number {
7
+ const set = new Set<number>(nums);
8
+
9
+ for (let i = 0; i < set.size + 1; i++) if (!set.has(i)) return i;
10
11
+ return 0;
12
+};
0 commit comments