Skip to content

Commit 3bfd34a

Browse files
contains duplicate
1 parent 25c4666 commit 3bfd34a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class Solution:
2+
def containsDuplicate(self, nums: List[int]) -> bool:
3+
s = set()
4+
for num in nums:
5+
if num in s:
6+
return True
7+
else:
8+
s.add(num)
9+
return False

0 commit comments

Comments
 (0)