Skip to content

Commit dca8310

Browse files
author
sap
committed
contains-duplicate solution
1 parent ee1ad8e commit dca8310

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

contains-duplicate/seona926.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* @param {number[]} nums
3+
* @return {boolean}
4+
*/
5+
let containsDuplicate = function (nums) {
6+
let counts = {};
7+
8+
return nums.some((num) => {
9+
if (counts[num] === undefined) {
10+
counts[num] = 1;
11+
return false;
12+
} else {
13+
return true;
14+
}
15+
});
16+
};

0 commit comments

Comments
 (0)