[包子求助] TD的total defense rebate# Money - 海外理财
c*g
1 楼
华丽丽地用了LinkedList, HashSet, TreeMap
Question 20.10 Given two words of equal length that are in a dictionary,
write a method to transform one word into another word by changing only one
letter at a time. The new word you get in each step must be in the
dictionary.
EXAMPLE:
Input: DAMP, LIKE
Output: DAMP->LAMP->LIMP->LIME->LIKE
既然dictionary可以用hashtable检查,而一个word的长度有限,先把变化的各种可能
组合列出来,直接用hashtable检查这些words是否存在于字典里。这样是不是更快,更
直观。
Question 20.10 Given two words of equal length that are in a dictionary,
write a method to transform one word into another word by changing only one
letter at a time. The new word you get in each step must be in the
dictionary.
EXAMPLE:
Input: DAMP, LIKE
Output: DAMP->LAMP->LIMP->LIME->LIKE
既然dictionary可以用hashtable检查,而一个word的长度有限,先把变化的各种可能
组合列出来,直接用hashtable检查这些words是否存在于字典里。这样是不是更快,更
直观。