add contains-duplicate py3 soln
This commit is contained in:
11
0217_contains-duplicate/python3/solution.py
Normal file
11
0217_contains-duplicate/python3/solution.py
Normal file
@@ -0,0 +1,11 @@
|
||||
class Solution:
|
||||
def containsDuplicate(self, nums: List[int]) -> bool:
|
||||
counts = {}
|
||||
|
||||
for num in nums:
|
||||
counts[num] = counts.get(num, 0) + 1
|
||||
|
||||
if counts[num] > 1:
|
||||
return True
|
||||
|
||||
return False
|
||||
Reference in New Issue
Block a user