```
class Solution {
func twoSum(_ nums: [Int], _ target: Int) -> [Int] {
var hashTable = [Int: Int]()
for i in 0..<nums.count {
let complement = target - nums[i]
if let index = hashTable[complement], index != i {
return [index, i]
}
hashTable[nums[i]] = i
}
return [Int]()
}
}
```