Is there anyone using trie to solve this problem? And what about A* search? Looking for new ideas


  • 0
    C

    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?


  • 0
    B

    I also use C++ to implement BFS, but the 37 test cases cost 464ms totally, havn't try the other method.


  • 0
    C

    That's amazing!
    I have tried to optimize, but it still needs about 1900 ms.
    Could you share the code?


  • 0
    H
    This post is deleted!

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.