We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8b2a045 commit aa011deCopy full SHA for aa011de
two-sum/yhkee0404.go
@@ -0,0 +1,11 @@
1
+func twoSum(nums []int, target int) []int {
2
+ indices := make(map[int]int)
3
+ for i, num := range nums {
4
+ j, ok := indices[target - num]
5
+ if ok {
6
+ return []int{j, i}
7
+ }
8
+ indices[num] = i
9
10
+ return []int{}
11
+}
0 commit comments