Skip to content

Commit f1e8a69

Browse files
committed
contains-duplicate solution
1 parent 4b7a233 commit f1e8a69

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

contains-duplicate/togo26.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)