1. 两数之和 goland实现
func twoSum(nums []int, target int) []int { ret := make([]int, 0) if len(nums) < 2 { return ret } for i:=0;i<len(nums);i++ { for j:=i+1;j<len(nums);j++ { if nums[i]+nums[j] == target { ret = append(ret, i) ret = append(ret, j) } } } return ret }