← All problems

Word Ladder

Hard graphsbfs LeetCode ↗
Shortest transformation sequence length from beginWord to endWord, changing one letter at a time through valid words.

Hints (0/3 revealed)

Log in to reveal hints progressively.

Complexity

Time O(n * L^2), Space O(n * L)

Common pitfalls

  • DFS (finds A path, not shortest)
  • Rebuilding neighbors by scanning all words each time

Your solution

Log in to save your code and track progress.