```
func twoSum(nums []int, target int) []int {
hash := make(map[int]int)
var res []int
for i := 0;i < len(nums); i += 1 {
toFind := target - nums[i]
f, found := hash[toFind]
if found == true {
res = append(res, f)
res = append(res, i)
return res
}
hash[nums[i]] = i
}
return res
}
```