摘要: Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWord, 阅读全文
posted @ 2017-04-03 18:06 王小丸子 阅读(188) 评论(0) 推荐(0) 编辑
摘要: 数的划分,典型的DP问题。 题目要求:给定一个数n,要求输出这个数所有的划分的种数(不包括等分)。比如3=2+1,只有一种划分,1不能再分,2 不能分解成1+1,(就是说 数不能等分) 因此可以先考虑,将n分成K份的情况。那么所有的划分就可以是将n分成2,3,4,5,。。。n-1份之和,当然其中还需 阅读全文
posted @ 2017-04-03 12:14 王小丸子 阅读(638) 评论(0) 推荐(0) 编辑