package main
import "fmt"
func twoSum(nums []int, target int) []int {
for i, x := range nums {
for j := i + 1; j < len(nums); j++ {
if x+nums[j] == target {
return []int{i, j}
}
}
}
return nil
}
func main() {
var n = []int{2, 7, 11, 15}
var i = 9
fmt.Println(twoSum(n, i))
}
package main
import "fmt"
func twoSum(nums []int, target int) []int {
for i := 0; i < len(nums); i++ {
for j := i + 1; j < len(nums); j++ {
if nums[i]+nums[j] == target {
return []int{i, j}
}
}
}
return nil
}
func main() {
var n = []int{2, 7, 11, 15}
var i = 9
fmt.Println(twoSum(n, i))
}