Reddit·Software Engineer·Technical Phone Screen
- Given a start word, an end word, and a dictionary of same-length words, find the shortest transformation sequence where each step changes exactly 1 or 2 characters (substitutions only) and every intermediate word must be in the dictionary. Return the path or an empty list if none exists.
- Why would you choose BFS over DFS for finding the shortest path in this word transformation problem?
- What is the time and space complexity of your solution?
- How would you optimize this solution for very large dictionaries?
- How does your solution behave when the start word is not present in the dictionary?
“I recognized the word ladder pattern pretty fast but the '1 or 2 characters' twist tripped me up for a minute.”