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 4b7a233 commit f1e8a69Copy full SHA for f1e8a69
1 file changed
contains-duplicate/togo26.js
@@ -0,0 +1,13 @@
1
+/**
2
+ * @param {number[]} nums
3
+ * @return {boolean}
4
+ */
5
+var containsDuplicate = function (nums) {
6
+ const numsSet = new Set(nums);
7
+ return numsSet.size !== nums.length;
8
+};
9
+
10
+/*
11
+TC: O(n) -> nums 개수 만큼
12
+SC: O(n) -> 중복 삭제 후 요소 수 만큼 메모리 사용
13
+*/
0 commit comments