Hello everyone, I am a Chinese noob programmer. I have practiced questions on leetcode.com for 2 years. During this time, I studied a lot from many Great Gods’ articles. After worship, I always wanted to write an article as they did, and now I take the courage to write my first article here.
This is an article summarizing topics related to dynamic programming. Its main inspiration comes from these two articles: Dynamic Programming Patterns and 怎样学好动态规划? - 穷码农的回答 - 知乎. DP is always a very difficult problem for me and lately, I have done dozens of questions to improve my DP skills. But the DP problem is so flexible that random practice has little effect. Therefore, I made further improvements based on these two articles and summarize some typical topics of DP problem. I hope this article can help you.
In this article, all problems come from leetcode.com and leetcode-cn.com which is a Chinese version of leetcode.com. By the way, because I am Chinese, I attached the Chinese translation after the English topics so that I can use this article more convenient in the future. Moreover, can anyone tell me how to create a table of contents? I wrote this article with VSCode and attempted many extensions to do this but all of them failed. I will be very grateful if you can tell me a way to achieve this function.
I will continue practicing DP problems on leetcode.com and will keep updating this article. If you have any better suggestions or supplements, welcome to put them in the comment area and @me. Now the main text begins.
1. Number Tower,数塔
- 118. Pascal’s Triangle
(Easy)
、118. 杨辉三角(简单)
- 119. Pascal’s Triangle II
(Easy)
、119. 杨辉三角 II(简单)
- 64. Minimum Path Sum
(Medium)
、64. 最小路径和(中等)
- 120. Triangle
(Medium)
、120. 三角形最小路径和(中等)
- 931. Minimum Falling Path Sum
(Medium)
、931. 下降路径最小和(中等)
- 1289. Minimum Falling Path Sum II
(hard)
、1289. 下降路径最小和 II(困难)
- 1301. Number of Paths with Max Score
(hard)
、1301. 最大得分的路径数目(困难)
2. Fibonacci Numbers,斐波那契数列
- Fibonacci numbers,斐波那契数列问题
- 509. Fibonacci Number
(Easy)
、509. 斐波那契数(简单)
- 1137. N-th Tribonacci Number
(Easy)
、1137. 第 N 个泰波那契数(简单)
- 509. Fibonacci Number
- Staircase,爬楼梯问题
- 70. Climbing Stairs
(Easy)
、70. 爬楼梯(简单)
- 746. Min Cost Climbing Stairs
(Easy)
、746. 使用最小花费爬楼梯(简单)
- 70. Climbing Stairs
- House thief,偷房子问题
- 198. House Robber
(Easy)
、198. 打家劫舍(简单)
- 213. House Robber II
(Medium)
、213. 打家劫舍 II(中等)
- 198. House Robber
3. Memory Search,记忆化搜索
- 139. Word Break
Medium
、139. 单词拆分中等
- 140. Word Break II
Hard
、140. 单词拆分 II困难
- 329. Longest Increasing Path in a Matrix
Hard
、329. 矩阵中的最长递增路径困难
- 1857. Largest Color Value in a Directed Graph
Hard
、1857. 有向图中最大颜色值困难
4. 0/1 Knapsack, 0/1 背包
- Equal Subset Sum Partition,相等子集划分问题
- 416. Partition Equal Subset Sum
(Medium)
、416. 分割等和子集(中等)
- 416. Partition Equal Subset Sum
- Subset Sum,子集和问题
- 494. Target Sum
(Medium)
、494. 目标和(中等)
- 494. Target Sum
- Minimum Subset Sum Difference,子集和的最小差问题
- 1049. Last Stone Weight II
(Medium)
、1049. 最后一块石头的重量 II(中等)
- 1049. Last Stone Weight II
- Other,其它