天题系列:Word Ladder II

乍一看还真以为和1 一样,呵呵

当然不是啦

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

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

For example,

Given:
start = "hit"
end = "cog"
dict = ["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.

ref “ http://www.1point3acres.com/bbs/thread-51646-1-1.html 上面 iostreamin写的

我决定不写啦

你可能感兴趣的:(word)