You are given two integer arrays: array $$$a$$$ of length $$$n$$$ and array $$$b$$$ of length $$$n+1$$$.
You can perform the following operations any number of times in any order:
Your task is to calculate the minimum number of aforementioned operations (possibly zero) required to transform the array $$$a$$$ into the array $$$b$$$. It can be shown that under the constraints of the problem, it is always possible.
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases.
Each test case consists of three lines:
Additional constraint on the input: the sum of $$$n$$$ over all test cases doesn't exceed $$$2 \cdot 10^5$$$.
For each test case, print a single integer — the minimum number of operations (possibly zero) required to transform the array $$$a$$$ into the array $$$b$$$.
3121 323 33 3 344 2 1 22 1 5 2 3
3 1 8
In the first example, you can transform $$$a$$$ into $$$b$$$ as follows: $$$[2] \rightarrow [2, 2] \rightarrow [1, 2] \rightarrow [1, 3]$$$.
Name |
---|