I use C++ to implement the BFS to solve this problem. 37 test cases cost 2144ms.
I think there may be more efficient algorithms for this. I have tried the A* search, and chosen the h(word) as the hamming distance between word and end, and found that it's even less efficient.
I have not tried the trie data structure. Have anyone tried that?
I also use C++ to implement BFS, but the 37 test cases cost 464ms totally, havn't try the other method.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.