Time Complexity - O(n)

Space Complexity - O(n)

- n = length of nums

```
def two_sum(nums, target)
seen = {}
nums.each_with_index do |num, idx|
other_idx = seen[target - num]
if other_idx && other_idx != idx
return [other_idx, idx]
end
seen[num] = idx
end
end
```