Skip to content

Commit 2e824d5

Browse files
committed
[main] two-sum review
1 parent 262b903 commit 2e824d5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

two-sum/jeongyunjae.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ class Solution:
33
def twoSum(self, nums: List[int], target: int) -> List[int]:
44
my_dict = {}
55

6-
for i in range(len(nums)):
7-
remaining = target - nums[i]
6+
for i, data in enumerate(nums):
7+
remaining = target - data
88
if remaining not in my_dict:
9-
my_dict[nums[i]] = i
9+
my_dict[data] = i
1010
else:
1111
return [my_dict[remaining], i]

0 commit comments

Comments
 (0)