We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 4d43cb6 + 7f282c3 commit b7c1554Copy full SHA for b7c1554
contains-duplicate/SamTheKorean.py
@@ -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