using static System.Math; using System; public class Hello { static void Main() { var T = int.Parse(Console.ReadLine().Trim()); while (T-- > 0) { var n = int.Parse(Console.ReadLine().Trim()); string[] line = Console.ReadLine().Trim().Split(' '); var a = Array.ConvertAll(line, int.Parse); getAns(n, a); } } static void getAns(int n, int[] a) { var ans = 0; for (int i = 0; i < n - 1; i++) { if (a[i] < a[i + 1]) continue; var d = a[i] - a[i + 1]; ans = Max(ans, d + 1); } Console.WriteLine(ans); } }