Skip to content

Commit 03140c1

Browse files
author
bhan
committed
contains duplicate solution
1 parent f291ae8 commit 03140c1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

contains-duplicate/byol-han.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct.
2+
/**
3+
* @param {number[]} nums
4+
* @return {boolean}
5+
*/
6+
var containsDuplicate = function (nums) {
7+
const uniqueSet = new Set(nums);
8+
return uniqueSet.size !== nums.length;
9+
};

0 commit comments

Comments
 (0)