Skip to content

Commit 870ef38

Browse files
author
jinbeom
committed
Add comments to the two sum solution
1 parent 39e61b9 commit 870ef38

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

two-sum/kayden.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ def twoSum(self, nums: List[int], target: int) -> List[int]:
88
check[num] = idx
99

1010
for idx, num in enumerate(nums):
11+
# 동일한 숫자 두 개가 합쳐져서 목표값이 되는 경우
1112
if num * 2 == target:
13+
# 그리고 그 숫자가 리스트에 두 개 이상 존재할 경우
1214
if check[num] != idx:
1315
return [idx, check[num]]
14-
else:
15-
continue
16+
continue
1617

1718
if target - num in check:
1819
return [check[num], check[target - num]]

0 commit comments

Comments
 (0)