two_sum(nums, target) that returns the indices of the two numbers in list nums that add up to target, using a single pass with a dict mapping value seen so far to its index (the classic O(n) approach, not the brute-force O(n^2) one).two_sum([2, 7, 11, 15], 9)
[0, 1]
nums[0] + nums[1] = 2 + 7 = 9.
two_sum([3, 2, 4], 6)
[1, 2]
2 + 4 = 6, at indices 1 and 2.
For each index i, check if `target - nums[i]` is already a key in a seen dict.
If not found, record `seen[nums[i]] = i` and continue.