Skip to content

Instantly share code, notes, and snippets.

@mumunuu
Created January 15, 2021 01:30
Show Gist options
  • Save mumunuu/134c26a4e6551aadf216bfebbde98588 to your computer and use it in GitHub Desktop.
Save mumunuu/134c26a4e6551aadf216bfebbde98588 to your computer and use it in GitHub Desktop.
algorithm(leetcode) Two Sum
func twoSum(nums []int, target int) []int {
for i := 0; i < len(nums); i++ {
for k := i + 1; k < len(nums); k++ {
if nums[i]+nums[k] == target {
return []int{i, k}
}
}
}
return []int{}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment