Merge pull request #23 from TCP404/master

添加0001.两数之和 Go版本
This commit is contained in:
Carl Sun
2021-05-12 14:06:24 +08:00
committed by GitHub

View File

@ -109,6 +109,19 @@ Python
Go
```go
func twoSum(nums []int, target int) []int {
for k1, _ := range nums {
for k2 := k1 + 1; k2 < len(nums); k2++ {
if target == nums[k1] + nums[k2] {
return []int{k1, k2}
}
}
}
return []int{}
}
```