Dynamic programming
Article Directory
1. Dynamic programming problem solving ideas
status
Optimal substructure
No aftereffect
Transfer equation
Classification discussion, careful enumeration
2. Overview of Linear DP
classification
LIS
LCS
Digital triangle
backpack
Specialty
Specialty
The DP state grows linearly along all dimensions
3. Basic model
- Maximum continuous subsequence sum
Let dp[i] denote the maximum sum of the continuous sequence with A[i] as the end - Longest non-decreasing subsequence (LIS)
Let dp[i] denote the length of the longest continuous non-decreasing subsequence ending in A[i] - The longest common subsequence (LCS)
orderdp[i][j]
represents the length of the LCS before the i position of the string A and the j position of the string B - The longest palindrome substring
orderdp[i][j]
indicates whether the substring represented by S[i] to S[j] is a palindrome substring - The number tower DP
commanddp[i][j]
represents the maximum sum that can be obtained on all paths to the bottom layer starting from the j-th number in the i-th row - DAG longest way
-------------------------------------------------- to be continued