We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f9dc342 commit 3804af1Copy full SHA for 3804af1
contains-duplicate/Jay-Mo-99.py
@@ -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