Solution: Word Ladder II
Explore the solution to the Word Ladder II problem by understanding how to use breadth-first search to find the shortest transformation paths and depth-first search backtracking to reconstruct all shortest sequences. This lesson helps you grasp a two-phase approach to efficiently find and enumerate all valid shortest word ladders.
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:
...