Skip to main content
Word Ladder | AlgoCracked
AlgoCracked
ProblemsWord Ladder
Hard38.0% acceptance
Blind75Hash TableStringBfs

Word Ladder

Given two words beginWord and endWord and a dictionary wordList , a transformation sequence changes beginWord into endWord one letter at a time. Every intermediate word (and endWord ) must appear in wordList , and consecutive words differ by exactly one letter. Return the number of words in the shortest such sequence (counting both endpoints), or 0 if no sequence exists. Input format Input is [beginWord, endWord, wordList] , e.g. [ hit , cog ,[ hot , dot , dog , lot , log , cog ]] .

Loading workspace…