#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
ll t, n, i;
cin >> t;
while(t--)
{
cin >> n;
map<ll, ll>mp;
ll a = 0, indx = 0, c = 0, result = 0, r;
for(i=1;i<=n;i++)
{
cin >> a;
r = mp[a];
if(r > 0)
{
indx = max(indx, r);
c = i - indx - 1;
}
c++;
mp[a] = i;
result = max(result, c);
}
cout << result << "\n";
}
return 0;
}
Comments
Post a Comment