youngyangyang04/leetcode-master-comment

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

youngyangyang04 opened this issue · 8 comments

// 例: 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])