版权声明:本文为博主原创文章,转载请注明出处:http://blog.jerkybible.com/2017/10/31/LeetCode-718-Maximum-Length-of-Repeated-Subarray/
题目要求
Given two integer arrays A and B, return the maximum length of an subarray that appears in both arrays.
Example 1:
Input:
A: [1,2,3,2,1]
B: [3,2,1,4,7]
Output: 3
Explanation:
The repeated subarray with maximum length is [3, 2, 1].
Note:
- 1 <= len(A), len(B) <= 1000
- 0 <= A[i], B[i] < 100
题意解析
给两个个数组,返回两个数组中显示的子数组的最大长度。
解法分析
这个题目用传统的表格动态规划就可以,不再详细说明,请看代码。
解题代码
|
|