Skip to content

Commit 892a279

Browse files
committed
contains duplicate solution
1 parent 5c3e525 commit 892a279

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

contains-duplicate/suhacs.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
/**
2+
* @description
3+
* time complexity: O(n)
4+
* space complexity: O(n)
5+
* approach/strategy:
6+
* 1. brute force + hash table
7+
*/
8+
9+
/**
10+
* @param {number[]} nums
11+
* @return {boolean}
12+
*/
13+
114
function containsDuplicate(nums) {
215
const setLength = [...new Set(nums)].length;
316
const numLength = nums.length;

0 commit comments

Comments
 (0)