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.
1 parent ee1ad8e commit 5b0fc61Copy full SHA for 5b0fc61
contains-duplicate/bemelon.py
@@ -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