Wrong answer in a->b->c?

  • 1

    For input:

    "a", "c", ["a", "b", "c"]

    my solution gives answer 1, while expected answer is 2. Why is that? "c" is in the dictionary, so "a" can be switched directly to c in only one iteration.
    Or am I missing something?

  • 6

    You have to return the length of shortest transformation sequence, which includes both the start and end words.

    So, the transformation is "a" -> "c", length = 2.

Log in to reply

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