Skip to content

Commit b7c1554

Browse files
authored
Merge pull request #2350 from SamTheKorean/main
[Sam] WEEK 1 Solutions
2 parents 4d43cb6 + 7f282c3 commit b7c1554

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

contains-duplicate/SamTheKorean.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# TC : O(n) n being a length of nums array and it iterates the nums array once
2+
# SC : O(n) n being a size of nums array
3+
class Solution:
4+
def containsDuplicate(self, nums: List[int]) -> bool:
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)