How do you solve the word ladder problem, where each step changes one letter?
Treat the dictionary as a graph where two words are connected if they differ in exactly one position, and find the shortest path from the start word to the end word with breadth first search. Instead of comparing every pair of words, you generate the neighbours of the current word by trying every position and every replacement letter, and check each generated candidate against the set of allowed words.
The trick that makes it fast is removing words from the dictionary as you visit them. Since the search only ever needs to reach each word once, a word that has already been used does not need to be considered again, and deleting it also stops other branches from re-expanding it.
The mechanism is that BFS explores in order of the number of steps taken, so the first time you reach the end word you have arrived by the shortest ladder. The set of remaining words acts as the visited structure, since a word that is no longer in the set has already been reached.
The trade-off to name is the cost of generating neighbours. There are n positions and twenty six candidate letters, so each expansion produces twenty six n candidate strings, and building those strings is not free. The alternative is a bidirectional search, which expands from both ends and roughly squares the search space, which is a substantial win on long ladders. The other detail is that the start word must be in the dictionary or handled separately, since it may or may not be reachable.