#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
ll T;
cin>>T;
while(T--){
ll n;
cin>>n;
ll ans=-1e18;
ll pre;
cin>>pre;
for(ll i=2;i<=n;i++){
ll t;
cin>>t;
ll c=max(t,pre);
ll j=0;
while(true){
if(j!=t&&j!=pre){
ans=max(ans,c-j);
break;
}
j++;
}
pre=t;
}
cout<<ans<<'\n';
}
return 0;
}

京公网安备 11010502036488号