Skip to content

Commit e735f08

Browse files
author
sangbeenmoon
committed
solved contains-duplicate
1 parent 0e5ffe5 commit e735f08

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

contains-duplicate/sangbeenmoon.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# time : O(n)
2+
# space : O(n)
3+
class Solution:
4+
def containsDuplicate(self, nums: List[int]) -> bool:
5+
d = {}
6+
for num in nums:
7+
if num in d:
8+
return True
9+
else:
10+
d[num] = True
11+
return False

0 commit comments

Comments
 (0)