Skip to content

Commit 3d40dbc

Browse files
committed
contains duplicate solution
1 parent 3e88765 commit 3d40dbc

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

contains-duplicate/doh6077.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
# set에 저장하면서 중복 여부 확인하기
3+
class Solution:
4+
def containsDuplicate(self, nums: list[int]) -> bool:
5+
hashset = set()
6+
for i in nums:
7+
if i in hashset:
8+
return True
9+
hashset.add(i)
10+
return False

two-sum/doh6077.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ def twoSum(self, nums: list[int], target: int) -> list[int]:
66
if diff in prevMap:
77
return [prevMap[diff], i]
88
prevMap[n] = i
9-

0 commit comments

Comments
 (0)