Sunday Evening Code
Sunday Evening Code
Example 1:
Input: beginWord = "hit", endWord = "cog", wordList =
["hot","dot","dog","lot","log","cog"]
Output:
[["hit","hot","dot","dog","cog"],["hit","hot","lot","log
","cog"]]
Explanation: There are 2 shortest transformation
sequences:
"hit" -> "hot" -> "dot" -> "dog" -> "cog"
"hit" -> "hot" -> "lot" -> "log" -> "cog"
Example 2:
Input: beginWord = "hit", endWord = "cog", wordList =
["hot","dot","dog","lot","log"]
Output: []
Explanation: The endWord "cog" is not in wordList,
therefore there is no valid transformation sequence.
Constraints:
● 1 <= beginWord.length <= 5
● endWord.length == beginWord.length
● 1 <= wordList.length <= 1000
● wordList[i].length == beginWord.length
● beginWord, endWord, and wordList[i] consist of
lowercase English letters.
● beginWord != endWord
● All the words in wordList are unique.
Example:
Assume that input has following content:
the day is sunny
it is the sunny day
we can go out
Problem Constraints
1 <= No.of reviews <= 200
1 <= No. of words in a review <= 1000
1 <= Length of an individual review <= 10,000
1 <= Number of Good Words <= 10,000
1 <= Length of an individual Good Word <= 4
All the alphabets are lower case (a - z)
Input Format
First argument is a string A containing "Good Words"
separated by "_" character
Example Input
Input 1:
A = "cool_ice_wifi"
B = ["water_is_cool", "cold_ice_drink",
"cool_wifi_speed"]
Example Output
Output 1:
[2, 0, 1]
Example Explanation
Explanation 1: