title | date |
---|---|
1. 两数之和 |
2019-06-17T22:48:00.000Z |
https://leetcode-cn.com/problems/two-sum/
func twoSum(nums []int, target int) []int {
for i, v1 := range nums {
remaining := target - v1
for j, v2 := range nums[i+1:] {
if remaining == v2 {
return []int{i, j + i + 1}
}
}
}
return []int{}
}