Skip to content

Commit 5821b74

Browse files
committed
contains-duplicate solution
1 parent b34981c commit 5821b74

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

contains-duplicate/devyejin.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
class Solution(object):
2-
def containsDuplicate(self, nums):
3-
return len(nums) != len(set(nums))
1+
from typing import List
2+
"""
3+
time complexity : O(n)
4+
space complexity : O(n)
5+
"""
6+
class Solution:
7+
def containsDuplicate(self, nums: List[int]) -> bool:
8+
return len(set(nums)) == len(nums)
49

0 commit comments

Comments
 (0)