Given an array and target sum, find two elements that add up to the target. For each element x, check if target - x exists in a map of previously seen values. Build the map as you scan: if (seen.count(target - x)) you found a pair; otherwise add seen[x] = i to record this element.
This finds pairs in time. Without a map, you'd need nested loops or with sorting and two pointers. Maps make this classic interview problem simple to solve.