func twoSum(nums []int, target int) []int {
hashTable := map[int]int{}
for i, v := range nums {
if i2, ok := hashTable[target-v]; ok {
return []int{i, i2}
}
hashTable[v] = i
}
return nil
}
Last modification:May 28, 2024
© Allow specification reprint