You are given two arrays A and B, of length N. You can select any subarray and then sort the elements in ascending order of that subarray for arrays A and B.
Find the minimum length of the subarray you can choose to make A and B same after performing the operation. A and B are permutations of each other.
Input Format:
Output Format:
For each test case, print the minimum length of the subarray you can choose to make A and B same after performing the operation.
Constraints:
1≤T≤101≤N≤1051≤A[i],B[i]≤105
First test case:
We can choose a subarray from index 2 to 3 (1-based indexing). Hence, the answer is 2.
Second test case:
We can choose a subarray from index 1 to 3 (1-based indexing). Hence, the answer is 3.