Skip to content

Commit 1bd28b2

Browse files
committed
Feat: contains-duplicate Solution
1 parent d71593f commit 1bd28b2

File tree

1 file changed

+3
-19
lines changed

1 file changed

+3
-19
lines changed

contains-duplicate/oddong.py

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
1-
a = [1, 2, 3, 5, 4]
2-
3-
a.sort()
4-
5-
print(a)
6-
print(set(a))
7-
print(type(set(a)))
8-
9-
convert_list_to_set = list(set(a))
10-
11-
print()
12-
print(a)
13-
print(convert_list_to_set)
14-
print()
15-
16-
if a == convert_list_to_set:
17-
print(True)
18-
else:
19-
print(False)
1+
class Solution:
2+
def containsDuplicate(self, nums: List[int]) -> bool:
3+
return len(nums) != len(set(nums))

0 commit comments

Comments
 (0)