Why the expected output is 0 not 5 for this case?


  • 1

    Hi Friends,

    I don't understand why I'm failing for this test case. I see an obvious path is "hit" -> "hot" -> "dot" -> "dog" -> "cog". What am I missing here?

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


  • 0

    ok. it seems that there were changes to the question description that endWord should be within wordDict.


Log in to reply
 

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