NumPy allowed · plain Python earns 10 bonus points
Implement Two Sum with a single-pass hash map -- O(n) instead of the O(n^2) brute-force nested loop, and the canonical first problem that teaches "trade memory for time" via hashing.
Implement two_sum(nums, target): for each number, check whether its complement (target - number) has already been seen; if so, return the pair of indices. Otherwise record the current number and its index and keep scanning.
two_sum(nums: list[int], target: int) -> list[int]