We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0e5ffe5 commit a815638Copy full SHA for a815638
1 file changed
contains-duplicate/hyejj19.ts
@@ -0,0 +1,12 @@
1
+function containsDuplicate(nums: number[]): boolean {
2
+ const numsMap = new Map();
3
+ nums.forEach(n => {
4
+ numsMap.set(n, (numsMap.get(n) || 0) + 1);
5
+ });
6
+
7
+ for (const [_, count] of numsMap) {
8
+ if (count >= 2) return true;
9
+ }
10
11
+ return false;
12
+}
0 commit comments