You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this problem given two words, begin Word and end Word, and a dictionary word List, return the number of words in the shortest transformation sequence from beginWord to endWord, or 0 if no such sequence exists. Only one letter can be changed at a time, and each transformed word must exist in the word list.
For example:
Input: beginWord = "hit", endWord = "cog", wordList = ["hot","dot","dog","lot","log","cog"]
Output: 5
One shortest transformation is "hit" -> "hot" -> "dot" -> "dog" -> "cog", which is 5 words long.
Input: beginWord = "hit", endWord = "cog", wordList = ["hot","dot","dog","lot","log"]
Output: 0
The endWord "cog" is not in the word list, so the transformation is not possible.
Constraints are:
1 <= beginWord.length <= 10
endWord.length == beginWord.length
1 <= wordList.length <= 5000
wordList[i].length == beginWord.length
beginWord, endWord, and wordList[i] consist of lowercase English letters.
Can you please assign this problem to me @indrakishore
The text was updated successfully, but these errors were encountered:
In this problem given two words, begin Word and end Word, and a dictionary word List, return the number of words in the shortest transformation sequence from beginWord to endWord, or 0 if no such sequence exists. Only one letter can be changed at a time, and each transformed word must exist in the word list.
For example:
Input: beginWord = "hit", endWord = "cog", wordList = ["hot","dot","dog","lot","log","cog"]
Output: 5
One shortest transformation is "hit" -> "hot" -> "dot" -> "dog" -> "cog", which is 5 words long.
Input: beginWord = "hit", endWord = "cog", wordList = ["hot","dot","dog","lot","log"]
Output: 0
The endWord "cog" is not in the word list, so the transformation is not possible.
Constraints are:
1 <= beginWord.length <= 10
endWord.length == beginWord.length
1 <= wordList.length <= 5000
wordList[i].length == beginWord.length
beginWord, endWord, and wordList[i] consist of lowercase English letters.
Can you please assign this problem to me @indrakishore
The text was updated successfully, but these errors were encountered: