摘要: This is a classic problem of Dynamic Programming. We define the statedp[i][j]to be the minimum number of operations to convertword1[0..i - 1]toword2[0... 阅读全文
posted @ 2015-07-02 22:12 jianchao-li 阅读(199) 评论(0) 推荐(0) 编辑
摘要: The idea to solve this problem is to first sort the intervals according to theirstartfield and then scan the intervals from head to tail and merge tho... 阅读全文
posted @ 2015-07-02 18:43 jianchao-li 阅读(252) 评论(0) 推荐(0) 编辑
摘要: A classic subroutine of merge sort. Just merge the elements from back to forth. Keep a pointer for the merged position of the element and two other po... 阅读全文
posted @ 2015-07-02 18:11 jianchao-li 阅读(176) 评论(0) 推荐(0) 编辑
摘要: The typical solution to this problem is to use Dynamic Programming. The state dp[i] represents whether s[0..i - 1] can be broken into words in wordDic... 阅读全文
posted @ 2015-07-02 11:48 jianchao-li 阅读(267) 评论(0) 推荐(0) 编辑
摘要: This link suggests a concise C++ recursive solution. The original code may be hard to understand at first and I have rewritten the code below. You may... 阅读全文
posted @ 2015-07-02 11:35 jianchao-li 阅读(519) 评论(0) 推荐(0) 编辑