Given two words A and B, and a dictionary, C, find the length of shortest transformation sequence from A to B, such that:
Note:
Input Format:
The first argument of input contains a string, A.
The second argument of input contains a string, B.
The third argument of input contains an array of strings, C.
Output Format:
Return an integer representing the minimum number of steps required to change string A to string B.
Constraints:
1 <= length(A), length(B), length(C[i]) <= 25
1 <= length(C) <= 5e3
Example :
Input 1:
A = "hit"
B = "cog"
C = ["hot", "dot", "dog", "lot", "log"]
Output 1:
5
Explanation 1:
"hit" -> "hot" -> "dot" -> "dog" -> "cog"
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.