Go
func twoSum(nums []int, target int) []int {
var mp map[int]int = make(map[int]int)
for i := 0; i< len(nums); i++ {
mp[nums[i]] = i
}
for i := 0; i< len(nums); i++ {
if j, ok := mp[target-nums[i]]; ok && j != i{
return []int{i, mp[target-nums[i]]}
}
}
return []int{}
}