As reported: Nutanix MTS-1 (2025), round 1, the second hard graph question: Word Ladder II.
Given beginWord, endWord and a dictionary wordList, return all shortest transformation sequences from beginWord to endWord: each step changes exactly one letter, and every intermediate word (and endWord) must be in wordList. Return [] if there is none. This is LeetCode 126 — Word Ladder II.
Example 1
beginWord = "hit", endWord = "cog", wordList = ["hot","dot","dog","lot","log","cog"]
-> [["hit","hot","dot","dog","cog"],["hit","hot","lot","log","cog"]]
Example 2
beginWord = "hit", endWord = "cog", wordList = ["hot","dot","dog","lot","log"] -> []
Constraints: 1 ≤ beginWord.length ≤ 5; 1 ≤ wordList.length ≤ 500; all words have the same length and are lowercase; the number of shortest sequences is at most 10^5.
Code runner format: one JSON value per line: beginWord, endWord, wordList (LeetCode's format). Implement findLadders(beginWord, endWord, wordList); sequences may be in any order.