Two lessons:
Dictionaries turn searches into lookups. This often improves time algorithms to time, at the cost of space.
The "seen so far" pattern is common. Store what you've processed, check if what you need has been seen.
Two Sum is a classic interview question. The dictionary approach is the expected answer.