ans = [] for _ in range(int(input())): input() a = list(map(int, input().split())) ret = 0 for i in range(1, len(a)): ret = max(ret, a[i - 1] - a[i] + 1) ans.append(ret) print(*ans, sep='\n')