youngyangyang04 / leetcode-master-comment

用来做评论区
0 stars 0 forks source link

[Vssue]0718.最长重复子数组.md #144

Open youngyangyang04 opened 3 weeks ago

youngyangyang04 commented 3 weeks ago

https://www.programmercarl.com/0718.%E6%9C%80%E9%95%BF%E9%87%8D%E5%A4%8D%E5%AD%90%E6%95%B0%E7%BB%84.html

Du1in9 commented 5 days ago
// 例: nums1 = [1,2,3,2,1], nums2 = [3,2,1,4,7]
i = 1: j = 3: 满足 1 == 1, 则 dp[1][3] = 0+1 = 1 (子序列 [1])
i = 2: j = 2: 满足 2 == 2, 则 dp[2][2] = 0+1 = 1 (子序列 [2])
i = 3: j = 1: 满足 3 == 3, 则 dp[3][1] = 0+1 = 1 (子序列 [3])
i = 4: j = 2: 满足 2 == 2, 则 dp[4][2] = 1+1 = 2 (子序列 [3,2])
i = 5: j = 3: 满足 1 == 1, 则 dp[5][3] = 2+1 = 3 (子序列 [3,2,1])