Word Ladder II

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

  • Only one letter can be changed at a time
  • Each intermediate word must exist in the dictionary

If there are multiple such sequence of shortest length, return all of them. Refer to the example for more details.

Example :


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




  • All words have the same length.
  • All words contain only lowercase alphabetic characters.
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.
Start solving Word Ladder II on Interview Code Editor
Sign Up
to access hints and editorial solutions for Word Ladder II
Asked In:


Click here to start solving coding interview questions