Skip to content

Commit 3709708

Browse files
committed
refactor Two Sum
1 parent f15ffef commit 3709708

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

go/two_sum.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
package main
33

44
func twoSum(nums []int, target int) []int {
5-
m := make(map[int]int)
5+
numsMap := make(map[int]int)
66
for i, n := range nums {
7-
if j, ok := m[target-n]; ok {
7+
if j, ok := numsMap[target-n]; ok {
88
return []int{i, j}
99
}
10-
m[n] = i
10+
numsMap[n] = i
1111
}
1212
return nil
1313
}

0 commit comments

Comments
 (0)