Skip to content

Commit e594a4b

Browse files
committed
two-sum solution
1 parent de91997 commit e594a4b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

two-sum/HYUNAHKO.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Solution:
2+
def twoSum(self, nums: List[int], target: int) -> List[int]:
3+
result = []
4+
if len(nums) >= 2 and len(nums) <= 1e4:
5+
for idx1, i in enumerate(nums):
6+
num1 = i
7+
for idx2 in range(idx1+1, len(nums)):
8+
num2 = nums[idx2]
9+
if ((num1 + num2) == target):
10+
result.append(idx1)
11+
result.append(idx2)
12+
return result

0 commit comments

Comments
 (0)