Solution: Word Ladder II
Explore how to identify and reconstruct all shortest transformation sequences from a start word to an end word using a two-phase algorithm. This lesson teaches you to apply breadth-first search for shortest path discovery and depth-first search backtracking to generate all valid paths, focusing on word ladder problems common in coding interviews.
We'll cover the following...
Statement
You are given two words, beginWord and endWord, and a dictionary of words called wordList. Your task is to find all the shortest transformation sequences from beginWord to endWord, such that:
Only one letter can be changed at a time.
Each transformed word must exist in the given
wordList.The transformation sequence must begin with
beginWordand end withendWord.
Return all the shortest transformation sequences as a list of lists. If no valid transformation exists, return an empty list.
Constraints:
...