Skip to content

Commit 5b0fc61

Browse files
committed
[LC] contains-duplicate
1 parent ee1ad8e commit 5b0fc61

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

contains-duplicate/bemelon.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class Solution:
2+
def containsDuplicate(self, nums: List[int]) -> bool:
3+
# Time Complexity: O(n)
4+
# Space Complexity: O(n)
5+
seen = set()
6+
for num in nums:
7+
if num in seen:
8+
return True
9+
seen.add(num)
10+
return False

0 commit comments

Comments
 (0)