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 beginWord and end with endWord.
Return all the shortest transformation sequences as a list of lists. If no valid transformation exists, return an empty list.
Constraints:
beginWord.length
endWord.length == beginWord.length
wordList.length
wordList[i].length == beginWord.length
beginWord, endWord, and wordList[i] consist of lowercase English letters.
beginWord != endWord
All the words in wordList are unique.
The sum of all shortest transformation sequences does not exceed
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 beginWord and end with endWord.
Return all the shortest transformation sequences as a list of lists. If no valid transformation exists, return an empty list.
Constraints:
beginWord.length
endWord.length == beginWord.length
wordList.length
wordList[i].length == beginWord.length
beginWord, endWord, and wordList[i] consist of lowercase English letters.
beginWord != endWord
All the words in wordList are unique.
The sum of all shortest transformation sequences does not exceed