Skip to content

Commit 986a34a

Browse files
authored
contains duplicate
1 parent 3c0af16 commit 986a34a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

contains-duplicate/0-chan.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* time complexity : O(n)
3+
* space complexity : O(n)
4+
*/
5+
function containsDuplicate(nums: number[]): boolean {
6+
const hasDuplicate = new Set(nums).size !== nums.length;
7+
return hasDuplicate;
8+
};

0 commit comments

Comments
 (0)