T=int(input()) for i in range(T): N=int(input()) A=list(map(int,input().split())) ans=0 for i in range(N-1): ans=max(ans,A[i]-A[i+1]+1) print(ans)