forked from chihungyu1116/leetcode-javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path126 Word Ladder II.js
30 lines (26 loc) · 887 Bytes
/
126 Word Ladder II.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Given two words (beginWord and endWord), and a dictionary's word list, find all shortest transformation sequence(s) from beginWord to endWord, such that:
// Only one letter can be changed at a time
// Each intermediate word must exist in the word list
// For example,
// Given:
// beginWord = "hit"
// endWord = "cog"
// wordList = ["hot","dot","dog","lot","log"]
// Return
// [
// ["hit","hot","dot","dog","cog"],
// ["hit","hot","lot","log","cog"]
// ]
// Note:
// All words have the same length.
// All words contain only lowercase alphabetic characters.
/**
* @param {string} beginWord
* @param {string} endWord
* @param {Set} wordList
* Note: wordList is a Set object, see:
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
* @return {string[][]}
*/
var findLadders = function(beginWord, endWord, wordList) {
};