动态规划

基础知识:这里指的是用 for 循环方式的动态规划,非 Memoization Search 方式。DP 可以在多项式时间复杂度内解决 DFS 需要指数级别的问题。常见的题目包括找最大最小,找可行性,找总方案数等,一般结果是一个 Integer 或者 Boolean

常见题目:

  • Leetcode 674 Longest Continuous Increasing Subsequence (接龙型 dp)
  • Leetcode 62 Unique Paths II
  • Leetcode 70 Climbing Stairs
  • Leetcode 64 Minimum Path Sum
  • Leetcode 368 Largest Divisible Subset (接龙型 dp)
  • Leetcode 300 Longest Increasing Subsequence (接龙型 dp)
  • Leetcode 354 Russian Doll Envelopes (接龙型 dp,300 的 2D 版)
  • Leetcode 256 Paint House
  • Leetcode 121 Best Time to Buy and Sell Stock
  • Leetcode 55 Jump Game
  • Leetcode 45 Jump Game II
  • Leetcode 132 Palindrome Partitioning II
  • Leetcode 312 Burst Balloons (区间型 dp)
  • Leetcode 1143 Longest Common Subsequence (前缀型 dp)
  • Leetcode 1062 Longest Repeating Substring (dp 方法与 longest common substring 一致)
  • Leetcode 718 Maximum Length of Repeated Subarray (和 1062 本质上一样)
  • Leetcode 174 Dungeon Game
  • Leetcode 115 Distinct Subsequences
  • Leetcode 72 Edit Distance
  • Leetcode 91 Decode Ways
  • Leetcode 639 Decode Ways II
  • Leetcode 712 Minimum ASCII Delete Sum for Two Strings
  • Leetcode 221 Maximal Square
  • Leetcode 1277 Count Square Submatrices with All Ones (可以使用 221 一样的解法)
  • Leetcode 198 House Robber
  • Leetcode 213 House Robber II
  • Leetcode 740 Delete and Earn
  • Leetcode 87 Scramble String
  • Leetcode 1140 Stone Game II
  • Leetcode 322 Coin Change
  • Leetcode 518 Coin Change II (01 背包型)
  • Leetcode 1048 Longest String Chain
  • Leetcode 44 Wildcard Matching
  • Leetcode 10 Regular Expression Matching
  • Leetcode 32 Longest Valid Parentheses
  • Leetcode 1235 Maximum Profit in Job Scheduling (DP + binary search)
  • Leetcode 1043 Partition Array for Maximum Sum
  • Leetcode 926 Flip String to Monotone Increasing
最后更新: 2/27/2024, 6:53:03 AM