/**
* @param {number[]} nums1
* @param {number[]} nums2
* @return {number}
*/
var findLength = function(nums1, nums2) {
let n = nums1.length , m = nums2.length
let num = 0
let dp = Array.from({ length: n+1 }, () => Array(m+1).fill(0));
// 得到全为0的二维数组dp
console.log(dp)
for(let i = n-1 ; i>=0 ; i-- ){
for(let j = m-1 ; j>=0 ; j-- ){
if(nums1[i]==nums2[j]){
dp[i][j] = 1+dp[i+1][j+1]
if(dp[i][j]>num) num = dp[i][j]
}
}
}
return num
};