Skip to content

Commit 0a3b42a

Browse files
committed
Week 01: contains-duplicate solution
1 parent 31ad063 commit 0a3b42a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

contains-duplicate/mandel-17.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from typing import List
2+
3+
class Solution:
4+
def containsDuplicate(self, nums: List[int]) -> bool:
5+
stack_list = []
6+
for i, n in enumerate(nums[:-1]):
7+
stack_list.append(n)
8+
if nums[i+1] in stack_list:
9+
return True
10+
else:
11+
if i == len(nums[:-2]):
12+
return False
13+
continue

0 commit comments

Comments
 (0)