Dynamic Planning---Interview Review

Dynamic programming

dzs3Is.png

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

  1. Maximum continuous subsequence sum
    Let dp[i] denote the maximum sum of the continuous sequence with A[i] as the end
  2. Longest non-decreasing subsequence (LIS)
    Let dp[i] denote the length of the longest continuous non-decreasing subsequence ending in A[i]
  3. The longest common subsequence (LCS)
    order dp[i][j]represents the length of the LCS before the i position of the string A and the j position of the string B
  4. The longest palindrome substring
    order dp[i][j]indicates whether the substring represented by S[i] to S[j] is a palindrome substring
  5. The number tower DP
    command dp[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
  6. DAG longest way

-------------------------------------------------- to be continued

300. The longest rising subsequence LIS

1143. The longest common subsequence LCS

120. The smallest path sum of the triangle

4. Exercises

198. The House Robbery

354. Russian doll envelope problem

72. Logical distance

Guess you like

Origin blog.csdn.net/qq_41076577/article/details/108355011