summaryrefslogtreecommitdiff
path: root/1_array_hashing
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-01-18 01:13:20 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-01-18 01:13:20 +0900
commitb4fff25e6f68327d67e1f55f9171061fc4597eef (patch)
treed9c9f995cf2f8521bc425b3c9d5e582ca6096755 /1_array_hashing
parent676d31a6da3c339ed4fac25e981b5c8c2b989656 (diff)
modified 1_array_hashing/two_sum.py
Diffstat (limited to '1_array_hashing')
-rw-r--r--1_array_hashing/two_sum.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/1_array_hashing/two_sum.py b/1_array_hashing/two_sum.py
index 42ad48e..0a7cf1d 100644
--- a/1_array_hashing/two_sum.py
+++ b/1_array_hashing/two_sum.py
@@ -42,10 +42,10 @@ from typing import Dict, List
class Solution:
def hashmap(self, nums: List[int], target: int) -> List[int]:
hm: Dict = {}
- for i, index in enumerate(nums):
- if target - index in hm:
- return [hm[target - index], i]
- hm[index] = i
+ for i, n in enumerate(nums):
+ if target - n in hm:
+ return [hm[target - n], i]
+ hm[n] = i
return [-1, -1]