動態規劃將大問題分解為重疊子問題,用記憶化 (Memoization) 或列表法 (Tabulation) 避免重複計算。一維 DP 的狀態只有一個維度。
Notes:
- 定義狀態和轉移方程式是核心
- 自頂向下(遞迴 + 記憶化)vs 自底向上(迭代)
- 如果只依賴前幾個狀態,可以用滾動變數優化空間
跨倉庫導讀#
- 對應理論章節:動態規劃 ↗
#5
Longest Palindromic Substring
#70
Climbing Stairs
#91
Decode Ways
#120
Triangle
#139
Word Break
#152
Maximum Product Subarray
#198
House Robber
#213
House Robber II
#256
Paint House
#279
Perfect Squares
#300
Longest Increasing Subsequence
#322
Coin Change
#343
Integer Break
#377
Combination Sum IV
#416
Partition Equal Subset Sum
#472
Concatenated Words
#647
Palindromic Substrings
#673
Number of Longest Increasing Subsequence
#691
Stickers to Spell Word
#740
Delete And Earn
#746
Min Cost Climbing Stairs
#837
New 21 Game
#983
Minimum Cost For Tickets
#1035
Uncrossed Lines
#1137
N-th Tribonacci Number
#1359
Count all Valid Pickup and Delivery Options
#1406
Stone Game III
#1626
Best Team with no Conflicts
#1799
Maximize Score after N Operations
#1856
Maximum Subarray Min Product
#1964
Find the Longest Valid Obstacle Course at Each Position
#2140
Solving Questions With Brainpower
#2369
Check if There is a Valid Partition For The Array
#2466
Count Ways to Build Good Strings