All challenges

Algorithm challenge · DSA

Word Ladder

Difficulty

hard

Time

~45m

Format

Single

Grading

Auto-graded

#python#javascript#typescript#go#java#cpp#rust#dsa#bfs#graphs
Mission file // read carefullyhard

Given beginWord, endWord, and a wordList, return the number of words in the shortest transformation sequence from beginWord to endWord, changing one letter at a time where each intermediate word must be in wordList. Return 0 if no such sequence exists. Count includes both endpoints.

Example

begin = "hit", end = "cog", list = ["hot","dot","dog","lot","log","cog"]  =>  5

Build with

ladderLength(beginWord: string, endWord: string, wordList: string[]) → int
PythonJavaScriptTypeScriptGoJavaC++Rust
4 tests · 1 hidden
Auto-graded on submit
Start challenge

Sign in to save your progress.