LC 127
LeetCode 127 · Hard

Word Ladder

Find the length of the shortest transformation from beginWord to endWord, changing one letter at a time through valid words.

BFS → · High frequency · Solve on LeetCode →

Try it

Step through the core mechanic. The simulator below runs the bfs shape this problem is built on.

Walk the pattern

No dedicated step-through for this one yet. The shape is BFS — its pattern page has the interactive walkthrough, the reference implementation, and a five-problem progression that this problem sits inside.

The approach

Words are nodes; an edge joins words differing by one letter. BFS from beginWord gives the shortest chain. Generate neighbours by trying every letter at every position against the dictionary set.

AspectValue
PatternBFS
Recognise it byShortest transformation chain — BFS on an implicit graph.
Time complexityO(N·L²)
Space complexityO(N·L)
DifficultyHard

Who asks it

Companies known to ask this problem, from public LeetCode company-tag aggregations. A signal of where to expect it, not a guarantee.