Word Ladder II Problem
Word Ladder II Problem — ExecCode Hard DSA Practice
Solve the Word Ladder II problem on ExecCode. Free online hard DSA practice in Arrays - Basics. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Find all shortest transformation sequences from beginWord to endWord where each adjacent pair differs by one letter and intermediate words are in wordList. Return the list of ladders (any order).
Examples
Input beginWord = "hit", endWord = "cog", wordList = ["hot", "dot", "dog", "lot", "log", "cog", "hat"]; Output [["hit", "hot", "dot", "dog", "cog"], ["hit", "hot", "lot", "log", "cog"]]. Input beginWord = "hit", endWord = "cog", wordList = ["hot", "dot", "dog", "lot", "log", "hat"]; Output []
Constraints
1 ≤ beginWord.length ≤ 5 (demo) wordList length ≤ 500 All words same length, lowercase
Practice Word Ladder II free on ExecCode. Browse DSA problems, topic map, and placement guides.