You are given an integer array $$$a$$$ containing $$$n$$$ elements.
A pair $$$(l, r) (1 \le l \le r \le n)$$$ is called Normal pair, if $$$^\dagger$$$ $$$MEX(a_{l},a_{l+1},....,a_{r-1},a_{r})$$$ has maximum value among all other pairs.
Out of all possible Normal pairs, find a pair $$$(l, r)$$$ which has a minimum value of $$$(r-l+1)$$$.
$$$^\dagger$$$ $$$MEX(b)$$$ is defined as the smallest non-negative integer which is not present in $$$b$$$. For example $$$MEX(1, 0, 3) = 2$$$, $$$MEX(2, 5, 3) = 0$$$.
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). The description of the test cases follows.
The first line of test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of the array $$$a$$$.
The second line of each test case contains $$$n$$$ space separated integers $$$a_{i}$$$ ($$$0 \le a_{i} \le 10^9$$$).
It is guaranteed that the sum of $$$n$$$ over all test cases doesn't exceed $$$10^5$$$.
For each test case, print a single integer — the minimum value of $$$(r-l+1)$$$, such that $$$MEX(a_{l},a_{l+1},....,a_{r-1},a_{r})$$$ has maximum value.
543 3 0 151 1 2 0 065 0 3 5 1 1610 11 23 22 9 387 4 2 4 0 7 2 1
2 3 4 1 4
In the $$$2^{nd}$$$ test case,
The possible Normal pairs are $$$(1, 4), (1, 5), (2, 4), (2, 5)$$$
So, for $$$l = 2, r = 4$$$, $$$MEX(1,2,0) = 3$$$ which is maximum.
Hence the smallest value of $$$(r-l+1) = 3$$$.
| Name |
|---|


