Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions contains-duplicate/SamTheKorean.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# TC : O(n) n being a length of nums array and it iterates the nums array once
# SC : O(n) n being a size of nums array
class Solution:
def containsDuplicate(self, nums: List[int]) -> bool:
seen = set()
for num in nums:
if num in seen:
return True
seen.add(num)
return False