summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2024-09-12 17:22:37 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2024-09-12 17:22:37 +0900
commit8a77bd0cf92a726f186cd7490f7ed6a94b936fab (patch)
tree7197e8be5fae75493ffef5b2799589d996224ff0
parentf0f7eac5318e55f684210dcaf82badb024fc42b5 (diff)
Init
-rw-r--r--1_array_hashing/contains_duplicate.py12
-rw-r--r--1_array_hashing/group_anagram.py2
2 files changed, 10 insertions, 4 deletions
diff --git a/1_array_hashing/contains_duplicate.py b/1_array_hashing/contains_duplicate.py
index ab100ea..ce87903 100644
--- a/1_array_hashing/contains_duplicate.py
+++ b/1_array_hashing/contains_duplicate.py
@@ -18,6 +18,12 @@ Example 2:
Input: nums = [1, 2, 3, 4]
Output: false
+
+Example 3:
+
+Input: nums = [1, 3, 4, 1]
+
+Output: true
"""
from typing import List, Set
@@ -42,9 +48,9 @@ class Solution:
return False
-case1 = [1, 2, 3, 4, 5]
-case2 = [2, 2, 3, 4, 5]
-case3 = [3, 4, 1, 6, 3]
+case1 = [1, 2, 3, 3]
+case2 = [1, 2, 3, 4]
+case3 = [1, 3, 4, 1]
solution = Solution()
print(f"hashset case1: {solution.hashset(case1)}")
print(f"hashset case2: {solution.hashset(case2)}")
diff --git a/1_array_hashing/group_anagram.py b/1_array_hashing/group_anagram.py
index f2085b2..77df0bc 100644
--- a/1_array_hashing/group_anagram.py
+++ b/1_array_hashing/group_anagram.py
@@ -65,7 +65,7 @@ video: https://youtu.be/vzdNOK2oB2E
1. dictionary
time: O(m*n*26) = O(m*n)
-space: O(m*n)
+space: O()
code:
```python
class Solution: