动态规划题目特点
动态规划思考方式
1 确定状态
- 最后一步(最优策略中使用的最后一枚硬币aK)
- 化成子问题(最少的硬币拼出更小的面值27-aK)
2 转移方程
- f[X] = min{f[X-2]+1, f[X-5]+1, f[X-7]+1}
3 初始条件和边界情况
- f[0] = 0, 如果不能拼出Y,f[Y]=正无穷
4 计算顺序
- f[0], f[1], f[2], …
坐标型动态规划
- Unique Path http://www.lintcode.com/en/problem/unique-paths/
- Unique Paths II http://www.lintcode.com/problem/unique-paths-ii/
- Minimum Path Sum http://www.lintcode.com/problem/minimum-path-sum/
- Longest Increasing Continuous Subsequence
http://www.lintcode.com/en/problem/longest-increasing-continuoussubsequence/ - Longest Increasing Subsequence
http://www.lintcode.com/problem/longest-increasing-subsequence/ - Russian Doll Envelopes
http://www.lintcode.com/problem/russian-doll-envelopes/
序列型动态规划
- Paint House http://www.lintcode.com/en/problem/paint-house/
- Paint House II http://www.lintcode.com/problem/paint-house-ii/
- House Robber http://www.lintcode.com/problem/house-robber/
- House Robber II http://www.lintcode.com/problem/house-robber-ii/
- Best Time To Buy And Sell Stock I II III IIII
http://www.lintcode.com/problem/best-time-to-buy-and-sell-stock-iii/
划分型动态规划
完美平方
https://www.lintcode.com/zh-cn/problem/perfect-squares/
分割回文串2
https://www.lintcode.com/zh-cn/problem/palindrome-partitioning-ii/
抄书(可用二分解)
https://www.lintcode.com/zh-cn/problem/copy-books/
区间型动态规划
最长的回文序列
https://www.lintcode.com/zh-cn/problem/longest-palindromic-subsequence/
双序列型动态规划
最长公共子序列
https://www.lintcode.com/zh-cn/problem/longest-common-subsequence/
交叉字符串
https://www.lintcode.com/zh-cn/problem/interleaving-string/
编辑距离
https://www.lintcode.com/zh-cn/problem/edit-distance/
不同的子序列
https://www.lintcode.com/zh-cn/problem/distinct-subsequences/