Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func twoSum(numbers []int, target int) []int {
- i,j:=0,len(numbers)-1
- sum:=numbers[i] + numbers[j]
- for sum != target {
- if sum < target {
- i++
- }else{
- j--
- }
- sum = numbers[i] + numbers[j]
- }
- return []int{i+1,j+1}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement