File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -4,8 +4,19 @@ def containsDuplicate(self, nums):
4
4
:type nums: List[int]
5
5
:rtype: bool
6
6
"""
7
+ #??
7
8
#sets don't allow duplicate elements.
8
9
#If the length of the set created from nums is different from the original list(nums), It means there are duplicates.
10
+
11
+ #Big O
12
+ #N: ??? ?? nums? ??(Length of the input list nums)
13
+ #
14
+ #Time Complexity: O(N)
15
+ #- set? nums? ?? n? ???? ????(Creating a set from nums): O(N)
16
+ #- ??? list? ?? nums?? ??? ??(Comparing the lengths between created list and original list) : O(1)
17
+ #
18
+ #Space Complexity: O(N)
19
+ #-set? nums? ??? ?? ????? n? ????(The set requires extra space depends on the size of nums) : O(N)
9
20
if len (list (set (nums ))) == len (nums ):
10
21
return False
11
22
else :
You can’t perform that action at this time.
0 commit comments