logo
Interview
    Interview Guide
    Coding Problems List
Sponsored: Coursera
Problems

Word Ladder II

Problem

Given two words (start and end), and a dictionary, find all shortest transformation sequence(s) from start to end, such that:

Only one letter can be changed at a timeEach intermediate word must exist in the dictionary

Notice: All words have the same length.All words contain only lowercase alphabetic characters.

Example

Given:

start = "hit"
end = "cog"
dict = ["hot","dot","dog","lot","log"]

Return

  [
    ["hit","hot","dot","dog","cog"],
    ["hit","hot","lot","log","cog"]
  ]

Online Judge