Maximum Length Of Repeated Subarray
medium
1. You are given two arrays of integers arr1 and arr2. 2. You have to find the maximum length of subarray that appears in both the given arrays.
Constraints
1 <= N,M <= 10^4 0 <= a[i], b[i] <= 10^3
Format
Input
A number N a1 a2.. N numbers A number M b1 b2.. M numbers
Output
An integer representing the maximum length of repeated subarray.
Example
Sample Input
5
5 4 3 2 1
6
7 8 4 3 2 5
Sample Output
3