标签:target turn app pen ++ func and fun 两数之和
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 }
标签:target turn app pen ++ func and fun 两数之和
原文地址:https://www.cnblogs.com/transfercai/p/10525404.html