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