Skip to content

Commit f8350fd

Browse files
committed
contains-duplicate
1 parent 53ce7c7 commit f8350fd

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

contains-duplicate/Yg-cho.js

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

0 commit comments

Comments
 (0)