Skip to content

Commit 61578ec

Browse files
author
이호찬
committed
contains-duplicate solution
1 parent f291ae8 commit 61578ec

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

contains-duplicate/lhc0506.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* @param {number[]} nums
3+
* @return {boolean}
4+
*/
5+
var containsDuplicate = function(nums) {
6+
const numsSet = new Set();
7+
nums.forEach(num => numsSet.add(num));
8+
9+
return nums.length !== numsSet.size;
10+
};

0 commit comments

Comments
 (0)