Really new to CS and just did it out of curiosity, and I'm really surprised that this not very clever piece of code outperforms most. Is it a bug or is this really one of the fastest possible solutions in python, can someone explain?

```
dic = {}
for i in range(len(nums)):
dic[nums[i]] = i
for i in range(len(nums)):
x = target - nums[i]
if x in dic:
if dic[x] != i:
return [i,dic[x]]
```