127. Word LadderHard
A transformation sequence from word
beginWordto wordendWordusing a dictionarywordListis a sequence of wordsbeginWord -> s1-> s2-> ... -> sksuch that:
- Every adjacent pair of words differs by a single letter.
- Every
sifor1 <= i <= kis in wordList. Note thatbeginWorddoes not need to be inwordList.sk== endWordGiven two words,
beginWordandendWord, and a dictionarywordList, return the number of words in the shortest transformation sequence frombeginWordtoendWord, or0if no such sequence exists.
- Problem
- Solutions