Given a dictionary {"DOG", "COT", "COG", "FOG", "DOT"}, start word "FOG", and target word "COT".
From "FOG", we can generate new words by changing each letter to any other letter from ‘A’ to ‘Z’, but only keep those present in the dictionary. Here, "COG" and "DOG" are valid next steps.
If any transformed word matches the target, we’ve succeeded. Otherwise, we repeat the process for each valid transformation. If no sequence leads to the target, the search fails. For instance, "FOG" → "COG" → "COT" is a valid path.
This problem naturally fits a breadth-first search (BFS) approach, using a queue to explore all possible transformations level by level.