两数之和
![](https://img2022.cnblogs.com/blog/1468919/202206/1468919-20220621170139459-1655278272.png)
https://leetcode.cn/problems/two-sum/
func twoSum(nums []int, target int) []int { mp:=make(map[int]int,len(nums)) //某个数字出现的次数 for i := range nums { if p, ok := mp[target-nums[i]]; ok { return []int{p, i} } mp[nums[i]] = i } return nil }
等风起的那一天,我已准备好一切