Skip to content

Commit 408f184

Browse files
committed
contains duplicate
1 parent f9dc342 commit 408f184

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

contains-duplicate/Totschka.ts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// https://leetcode.com/problems/contains-duplicate/
2+
function containsDuplicate(nums: number[]): boolean {
3+
const counter = {};
4+
for (const n of nums) {
5+
if (!counter[n]) {
6+
counter[n] = 1;
7+
} else {
8+
return true;
9+
}
10+
}
11+
return false;
12+
}

0 commit comments

Comments
 (0)