Skip to content

Commit 3804af1

Browse files
committed
contains-duplicate
1 parent f9dc342 commit 3804af1

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

contains-duplicate/Jay-Mo-99.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Solution(object):
2+
def containsDuplicate(self, nums):
3+
"""
4+
:type nums: List[int]
5+
:rtype: bool
6+
"""
7+
#sets don't allow duplicate elements.
8+
#If the length of the set created from nums is different from the original list(nums), It means there are duplicates.
9+
if len(list(set(nums))) == len(nums):
10+
return False
11+
else:
12+
return True

0 commit comments

Comments
 (0)