首页 > TAG信息列表 > tmpmap

ALGO-双指针

167. Two Sum II - Input Array Is Sorted func twoSum(numbers []int, target int) []int { tmpMap := make(map[int]int, 10) for idx, val := range numbers { v, ok := tmpMap[target-val] if ok { return []int{v + 1, idx + 1} } tmpMap[val] = idx } r