Skip to content

Commit a5a0744

Browse files
committed
Add solution for Contains Duplicate
1 parent 1affa63 commit a5a0744

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

contains-duplicate/gcount85.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Approach : De-duplicate using Set
2+
# Complexity: O(n)
3+
# Space complexity: O(n)
4+
5+
6+
class Solution:
7+
def containsDuplicate(self, nums: List[int]) -> bool:
8+
dedup = set(nums)
9+
return len(dedup) != len(nums)

0 commit comments

Comments
 (0)