Skip to content

Commit c2f53f1

Browse files
author
ssuu
committed
Contains Duplicate solution
1 parent 53ce7c7 commit c2f53f1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

contains-duplicate/gguussuu.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* @param {number[]} nums
3+
* @return {boolean}
4+
*/
5+
var containsDuplicate = function(nums) {
6+
//Set은 중복된 값을 허용하지 않기 때문에, 배열을 Set으로 변환한 후 길이를 비교하여 중복 여부를 확인
7+
const hasDuplicate = new Set(nums).size !== nums.length;
8+
return hasDuplicate;
9+
};

0 commit comments

Comments
 (0)