Skip to content

Bug Report for word-ladder #6202

Description

@OmkumarMangukiya

Bug Report for https://neetcode.io/problems/word-ladder

The test cases appear to be missing the case where beginWord == endWord.

According to the problem statement, the answer is the minimum number of words in the transformation sequence needed to obtain endWord. Therefore, when beginWord == endWord, the transformation sequence already contains the single word itself, so the answer should be 1, not 0.

For example:

beginWord = "cat"
endWord = "cat"
wordList = ["cat"]

Expected output:
1

However, returning 0 for beginWord == endWord passes the current test cases.

Could a test case covering this edge case be added?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions