
The first line contains 'T', denoting the number of test cases.
For each Test :
The first line contains two space separated integers 'N' and ‘M’, denoting the number of moves in the first and second game respectively.
The second line contains an array 'A' of length 'N', denoting the moves of the first game.
The third line contains an array 'B' of length 'M', denoting the moves of the second game.
For each test, print an integer, denoting the length of the longest Combo which occurred in both rounds.
You are not required to print the expected output. It has already been taken care of. Just implement the function.
1 <= T <= 10
1 <= N,M <= 10^3
1 <= A[i] <= 10^9, i ∈ (1,N)
1 <= B[j] <= 10^9, j ∈ (1,M)
The sum of 'N' and ‘M’ over all test cases does not exceed 2000.
Time Limit: 1 sec
Algorithm:
If A[i] == B[j]: dp[i][j] = 1 + dp[i-1][j-1]
Else: dp[i][j] = 0;
The answer will be maximum of dp[i][j] for all ‘i’ ∈ (1,N) and ‘j’ ∈ (1,M)
Algorithm: