End of Year Sale: Use Coupon Code END2025 to Get Extra 25% Off.
dp with dimensions (len(nums1) + 1) x (len(nums2) + 1) and fill it with zeros.nums1 and nums2 using two nested loops.i and j, check if nums1[i] is equal to nums2[j].dp[i+1][j+1] to dp[i][j] + 1.dp array during the iteration.