Word Ladder
Find the length of the shortest transformation from beginWord to endWord, changing one letter at a time through valid words.
Try it
Step through the core mechanic. The simulator below runs the bfs shape this problem is built on.
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.
| Aspect | Value |
|---|---|
| Pattern | BFS |
| Recognise it by | Shortest transformation chain — BFS on an implicit graph. |
| Time complexity | O(N·L²) |
| Space complexity | O(N·L) |
| Difficulty | Hard |
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.