Skip to content

Commit 609e3c7

Browse files
committed
contains duplicate solution
1 parent b338303 commit 609e3c7

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* @param {number[]} nums
3+
* @return {boolean}
4+
*/
5+
var containsDuplicate = function(nums) {
6+
let arrToSet = new Set(nums);
7+
8+
const originalLength = nums.length;
9+
const filteredLength = arrToSet.size;
10+
11+
if(originalLength === filteredLength){
12+
return false; // 겹치는 숫자가 없는 경우
13+
} else {
14+
return true; // 겹치는 숫자가 있는 경우
15+
}
16+
17+
};

0 commit comments

Comments
 (0)