Solution approach/Hints

  • 0


    1. Graph problem
    2. Convert it to a shortest path problem


    find words that differ by 1 edit

    do a bfs from start to endword

    get all paths that can reach : A cute trick is involved here . Find the distance of each node between source and destination. Do a DFS from goal such that you visit nodes which will lead you to the source faster than the current one!

    Note: average word lengths are typically around 10. but the number of words can be very high. speed up your adjacency list calculation if you havent taken this into consideration

Log in to reply

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