A good problem for me to analysis the time complexity. At first I want to create a graph for each word, I mean check each word is a available for the other. However, when I look up the solution I think the time complexity is O(n^2) to create the graph. Then I use the solution which they provide: for each position, try character from ‘a’ to ‘z’ literately, then see if current string is in the dictionary or not. So that the time complexity is O(n * 26^i)
Also, need to mention that we should use a map to know previous change position, so that it will go back.
Error:
N/A