message: fix word ladder issue for python
diff: @@ -26,25 +26,26 @@ class Solution:
  # @param end, a string
  # @param dict, a set of string
  # @return an integer
  - def ladderLength(self, start, end, dict):
  + def ladderLength(self, start, end, word_list):
  distance, cur, visited = 0, [start], set([start])
  - dict.add(end)
  while cur:
  - next = []
  + _next = []
  +
  for word in cur:
  if word == end:
  return distance + 1
  for i in xrange(len(word)):
  for j in 'abcdefghijklmnopqrstuvwxyz':
  candidate = word[:i] + j + word[i + 1:]
  - if candidate not in visited and candidate in dict:
  - next.append(candidate)
  + if candidate not in visited and candidate in word_list:
  + _next.append(candidate)
  visited.add(candidate)
  distance += 1
  - cur = next
  + cur = _next
  return 0
  if __name__ == "__main__":
  print Solution().ladderLength("hit", "cog", set(["hot", "dot", "dog", "lot", "log"]))
  + print Solution().ladderLength("hit", "cog", set(["hot", "dot", "dog", "lot", "log", "cog"]))
  