Wrong result for testcase?


  • 1
    X

    Something wrong with the following test case? From my understanding hit->hot->dot->dog->cog is a correct answer. So in this case, the ladder length should be 5. Am I missing something?

    Input:
    "hit"
    "cog"
    ["hot","dot","dog","lot","log"]
    Output:
    5
    Expected:
    0


  • 1
    X

    @xthron I also faced same problem.


  • 2
    H

    See the rule #2 in the problem description: Each transformed word must exist in the word list. Note that beginWord is not a transformed word. That means the endWord should be in the dict.


Log in to reply
 

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