You're given an array $a_1, \ldots, a_n$ of $n$ non-negative integers.

Let's call it sharpened if and only if there exists an integer $1 \le k \le n$ such that $a_1 < a_2 < \ldots < a_k$ and $a_k > a_{k+1} > \ldots > a_n$. In particular, any strictly increasing or strictly decreasing array is sharpened. For example:  The arrays $[4]$, $[0, 1]$, $[12, 10, 8]$ and $[3, 11, 15, 9, 7, 4]$ are sharpened;  The arrays $[2, 8, 2, 8, 6, 5]$, $[0, 1, 1, 0]$ and $[2, 5, 6, 9, 8, 8]$ are not sharpened. 

You can do the following operation as many times as you want: choose any strictly positive element of the array, and decrease it by one. Formally, you can choose any $i$ ($1 \le i \le n$) such that $a_i>0$ and assign $a_i := a_i - 1$.

Tell if it's possible to make the given array sharpened using some number (possibly zero) of these operations.


-----Input-----

The input consists of multiple test cases. The first line contains a single integer $t$ ($1 \le t \le 15\ 000$)  — the number of test cases. The description of the test cases follows.

The first line of each test case contains a single integer $n$ ($1 \le n \le 3 \cdot 10^5$).

The second line of each test case contains a sequence of $n$ non-negative integers $a_1, \ldots, a_n$ ($0 \le a_i \le 10^9$).

It is guaranteed that the sum of $n$ over all test cases does not exceed $3 \cdot 10^5$.


-----Output-----

For each test case, output a single line containing "Yes" (without quotes) if it's possible to make the given array sharpened using the described operations, or "No" (without quotes) otherwise.


-----Example-----
Input
10
1
248618
3
12 10 8
6
100 11 15 9 7 8
4
0 1 1 0
2
0 0
2
0 1
2
1 0
2
1 1
3
0 1 0
3
1 0 1

Output
Yes
Yes
Yes
No
No
Yes
Yes
Yes
Yes
No



-----Note-----

In the first and the second test case of the first test, the given array is already sharpened.

In the third test case of the first test, we can transform the array into $[3, 11, 15, 9, 7, 4]$ (decrease the first element $97$ times and decrease the last element $4$ times). It is sharpened because $3 < 11 < 15$ and $15 > 9 > 7 > 4$.

In the fourth test case of the first test, it's impossible to make the given array sharpened.

Source: codeforces | Difficulty: EASY
Tags: Implementation

Greedy algorithms


Solutions:
t = int(input())
for _ in range(0, t):
	n = int(input())
	A = list(map(int, input().split()))
	c = 1
	p = -1
	s = n
	for i in range(0, n):
		if A[i] < i:
			break
		p = i
	for i in range(n - 1, -1, -1):
		if A[i] < n - 1 - i:
			break
		s = i
	if s <= p:
		print('Yes')
	else:
		print('No')


cases = int(input())
for _ in range(cases):
	n = int(input())
	nums = list(map(int, input().split()))
	left = 0
	right = 0
	for a in nums:
		if a < left:
			break
		left += 1
	for a in nums[::-1]:
		if a < right:
			break
		right += 1
	if left + right <= n:
		print('No')
	else:
		print('Yes')


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	k1 = 0
	k2 = 0
	for i in range(n):
		if l[i] >= i:
			k1 = i
		else:
			break
	for i in range(n):
		if l[n - i - 1] >= i:
			k2 = n - i - 1
		else:
			break
	if k1 >= k2:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	p = -1
	s = n
	for i in range(0, n):
		if a[i] < i:
			break
		p = i
	for i in range(n - 1, -1, -1):
		if a[i] < n - 1 - i:
			break
		s = i
	if s <= p:
		print('Yes')
	else:
		print('No')


def g_eq(a1, a2):
	for i in range(len(a1)):
		if a1[i] < a2[i]:
			return False
	return True

def sharpen(arr, arr_len):
	k = arr_len // 2
	to_compare = list(range(k)) + [k] + list(range(k)[::-1])
	if arr_len % 2 == 0:
		to_compare = [to_compare[1:], to_compare[:-1], to_compare[:k - 1] + to_compare[k:], to_compare[:k + 1] + to_compare[k + 2:]]
	else:
		to_compare = [to_compare]
	for i in to_compare:
		if g_eq(arr, i):
			return 'Yes'
	return 'No'
t = int(input())
for _ in range(t):
	l = int(input())
	a = [int(i) for i in input().split()]
	print(sharpen(a, l))


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
sys.setrecursionlimit(10 ** 5)
from queue import PriorityQueue
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	flag = 0
	i = 0
	pre = -1
	yo = []
	for i in range(n):
		if l[i] >= i:
			yo.append(l[i])
			l[i] = i
			continue
		else:
			l[i - 1] = yo[-1]
			flag = 1
			break
	if flag == 0:
		print('Yes')
		continue
	flag = 0
	for i in range(i, n):
		z = l[i - 1] - 1
		if l[i] >= z and z >= 0:
			l[i] = z
		elif l[i - 1] > l[i]:
			continue
		else:
			flag = 1
			break
	if flag:
		print('No')
	else:
		print('Yes')


def c(n, a):
	for i in range(n):
		if a[i] < i:
			return i
	return n
for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	cntl = c(n, a)
	cntr = n - 1 - c(n, a[::-1])
	if cntl <= cntr or cntl - cntr == 1:
		print('No')
	else:
		print('Yes')


for _ in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	s = 0
	e = 0
	for x in range(n):
		if x == n - 1:
			s = n
		if l[x] >= x:
			continue
		s = x
		break
	l.reverse()
	for x in range(n):
		if x == n - 1:
			e = n
		if l[x] >= x:
			continue
		e = x
		break
	print('Yes' if s + e > n else 'No')


import sys
import bisect as bi
import math
from collections import defaultdict as dd
import heapq
import itertools
input = sys.stdin.readline
import random
mo = 10 ** 9 + 7

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())

def pref(a, n, f):
	pre = [0] * n
	if f == 0:
		pre[0] = a[0]
		for i in range(1, n):
			pre[i] = a[i] + pre[i - 1]
	else:
		pre[-1] = a[-1]
		for i in range(n - 2, -1, -1):
			pre[i] = pre[i + 1] + a[i]
	return pre

def deccheck(l, n):
	k = [i for i in range(n)]
	k = k[::-1]
	for i in range(0, n):
		if l[i] < k[i]:
			return False
	return True
for _ in range(inin()):
	n = inin()
	l = ain()
	k = 0
	if n == 1 or (n == 2 and l != [0, 0]):
		print('YES')
	elif n == 2:
		print('NO')
	else:
		for i in range(1, n):
			if l[i] >= i:
				continue
			else:
				k = i
				break
		if k == 0:
			print('YES')
		elif deccheck(l[k - 1:], n - k + 1):
			print('YES')
		else:
			print('NO')


import sys

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7

def check(A, B):
	for i in range(N):
		if A[i] < B[i]:
			return False
	return True
for _ in range(INT()):
	N = INT()
	A = LIST()
	if N % 2 == 0:
		B1 = [0] * N
		B2 = [0] * N
		for i in range(N // 2 - 1):
			B1[i] = B2[i] = i
		B1[N // 2 - 1] = B2[N // 2] = N // 2
		B2[N // 2 - 1] = B1[N // 2] = N // 2 - 1
		for i in range(N // 2 + 1, N):
			B1[i] = B2[i] = N - i - 1
		if check(A, B1) or check(A, B2):
			Yes()
		else:
			No()
	else:
		B = [0] * N
		for i in range(N // 2):
			B[i] = i
		for i in range(N // 2, N):
			B[i] = N - i - 1
		if check(A, B):
			Yes()
		else:
			No()


from collections import defaultdict
from math import *
import os
import sys
from io import BytesIO, IOBase
from heapq import nlargest
from bisect import *
import copy
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
t = int(input())
while t:
	t -= 1
	n = int(input())
	arr = list(map(int, input().split()))
	pos = n - 1
	for i in range(n):
		if arr[i] < i:
			pos = i - 1
			break
	k = 0
	pos2 = 0
	for i in range(n - 1, -1, -1):
		if arr[i] >= k:
			k += 1
		else:
			pos2 = i + 1
			break
	print('Yes') if pos >= pos2 else print('No')


t = int(input())
while t != 0:
	t -= 1
	n = int(input())
	l = list(map(int, input().split()))
	(i, j) = (0, n - 1)
	for k in range(n):
		if l[k] < k:
			break
		i = k
	for k in range(n - 1, -1, -1):
		if l[k] < n - k - 1:
			break
		j = k
	print('Yes' if j <= i else 'No')


for tc in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	i = 0
	j = n - 1
	p = 0
	f = 1
	while i <= j:
		if l[i] >= p and l[j] >= p:
			p += 1
			i += 1
			j -= 1
		else:
			f = 0
			break
	if n % 2 == 0:
		if l[j] == l[i] == p - 1:
			f = 0
	print('YES') if f else print('NO')


t = int(input())
for loop in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	lis = [None] * n
	flag = False
	for i in range(n):
		if a[i] >= i:
			lis[i] = i
		else:
			break
	for i in range(n):
		j = n - 1 - i
		if lis[j] == None and a[j] >= i:
			lis[j] = i
		else:
			if lis[j] != None and (j == n - 1 or lis[j] != lis[j + 1]):
				flag = True
			break
	if flag:
		print('Yes')
		continue
	lis = [None] * n
	for i in range(n):
		j = n - 1 - i
		if a[j] >= i:
			lis[j] = i
		else:
			break
	for i in range(n):
		if lis[i] == None and a[i] >= i:
			lis[i] = i
		else:
			if lis[i] != None and (i == 0 or lis[i] != lis[i - 1]):
				flag = True
			break
	if flag:
		print('Yes')
	else:
		print('No')


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools
from collections import deque, defaultdict, OrderedDict
import collections

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	zz = 0
	for _ in range(ri()):
		n = ri()
		a = ria()
		k1 = 0
		k2 = 0
		for i in range(n):
			if a[i] >= i:
				k1 += 1
			else:
				break
		for i in range(n):
			if a[n - 1 - i] >= i:
				k2 += 1
			else:
				break
		if k1 + k2 > n:
			print('Yes')
		else:
			print('No')
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


t = int(input())
for i in range(t):
	n = int(input())
	y = list(map(int, input().split()))
	if n == 1:
		print('Yes')
	else:
		pr = 1
		for i in range(n // 2):
			if y[i] < i or y[n - 1 - i] < i:
				print('No')
				pr = 0
				break
		if pr:
			if n % 2 == 0:
				if y[n // 2 - 1] == y[n // 2] and y[n // 2] == n // 2 - 1:
					print('No')
				else:
					print('Yes')
			elif y[n // 2] >= n // 2:
				print('Yes')
			else:
				print('No')


t = int(input())
while t:
	t -= 1
	n = int(input())
	lip = list(map(int, input().split()))
	(pref, suff) = (-1, n)
	for i in range(n):
		if lip[i] < i:
			break
		pref = i
	for i in range(n - 1, -1, -1):
		if lip[i] < n - 1 - i:
			break
		suff = i
	if suff <= pref:
		print('Yes')
	else:
		print('No')


t = int(input())
for i in range(t):
	n = int(input())
	A = [int(i) for i in input().split()]
	a0 = A[0]
	d = []
	for j in range(1, n):
		a1 = A[j]
		d.append(a1 - a0)
		a0 = a1
	fl = True
	res = True
	if n == 1:
		fl = False
	elif n == 2:
		fl = False
		if A[0] == 0 and A[1] == 0:
			res = False
	ind = 0
	v = True
	while fl:
		d0 = d[ind]
		if v:
			if d0 <= 0:
				if A[ind + 1] < ind + 1:
					v = False
					if A[ind] < n - ind - 1:
						fl = False
						res = False
		elif d0 >= 0:
			if A[ind] < n - ind - 1:
				fl = False
				res = False
		ind += 1
		if ind >= n - 1:
			fl = False
	if res:
		print('Yes')
	else:
		print('No')


t = int(input())
for k in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	l = 0
	r = 0
	for i in range(n):
		if a[i] >= i:
			l = i
		else:
			break
	for i in range(n - 1, -1, -1):
		if a[i] >= n - 1 - i:
			r = i
		else:
			break
	if r <= l:
		print('YES')
	else:
		print('NO')


import sys

def solve():
	n = int(sys.stdin.readline())
	a = list(map(int, sys.stdin.readline().split()))
	i = 0
	while i < n and a[i] >= i:
		i += 1
	j = n - 1
	while j >= 0 and a[j] >= n - 1 - j:
		j -= 1
	if i > j + 1:
		print('Yes')
	else:
		print('No')

def main():
	t = int(sys.stdin.readline())
	for _ in range(t):
		solve()
main()


from collections import Counter, defaultdict
from sys import stdin, stdout
input = stdin.readline
I = lambda : int(input())
M = lambda : map(int, input().split())
LI = lambda : list(map(int, input().split()))
for _ in range(I()):
	n = I()
	a = LI()
	flag = 0
	if n == 1:
		print('Yes')
	else:
		flag = 1
		c = max(a[0], a[-1])
		for i in range((n + 1) // 2):
			if i != (n + 1) // 2 - 1:
				if a[i] >= i and a[n - 1 - i] >= i:
					continue
				else:
					flag = 0
					break
			elif n % 2 == 1:
				if a[i] < i:
					flag = 0
					break
			elif a[i] == a[n - 1 - i] and a[i] == i:
				flag = 0
				break
			elif a[i] < i or a[n - 1 - i] < i:
				flag = 0
				break
		if flag:
			print('Yes')
		else:
			print('No')


def ebne(n, arr):
	pre = -1
	suff = n
	i = 0
	while i < n:
		if arr[i] < i:
			break
		i += 1
	pre = i - 1
	j = n - 1
	while j > -1:
		if arr[j] < n - 1 - j:
			break
		j -= 1
	suff = j + 1
	if pre >= suff:
		return 'Yes'
	return 'No'
t = int(input())
for _ in range(t):
	n = int(input())
	s = list(map(int, input().strip().split()))
	print(ebne(n, s))


t = int(input())
for t0 in range(t):
	n = int(input())
	list1 = input().split(' ')
	j1 = True
	j2 = True
	j3 = True
	if n == 1:
		print('Yes')
	elif n % 2 == 1:
		n1 = int((n + 1) / 2)
		n2 = int(-n1)
		for n0 in range(0, n1):
			if int(list1[n0]) < n0:
				j1 = False
		for n0 in range(n2, 0):
			if int(list1[n0]) < -n0 - 1:
				j2 = False
		if j1 == True and j2 == True:
			print('Yes')
		else:
			print('No')
	else:
		n1 = int(n / 2)
		n2 = int(-n / 2)
		n3 = int(n / 2 - 1)
		for n0 in range(0, n1):
			if int(list1[n0]) < n0:
				j1 = False
		for n0 in range(n2, 0):
			if int(list1[n0]) < -n0 - 1:
				j2 = False
		if int(list1[n3]) == n3 and int(list1[n1]) == n3:
			j3 = False
		if j1 == True and j2 == True and (j3 == True):
			print('Yes')
		else:
			print('No')


T = int(input())
for cs in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	left = [True for i in range(n)]
	right = [True for i in range(n)]
	for i in range(1, n):
		left[i] = left[i - 1] and i <= a[i]
		right[n - i - 1] = right[n - i] and i <= a[n - i - 1]
	found = False
	for i in range(n):
		if left[i] and right[i]:
			found = True
			break
	if found:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	f = 0
	k = n // 2
	s = -1
	e = n
	for i in range(n):
		if l[i] < i:
			break
		s = i
	for i in range(n - 1, -1, -1):
		if l[i] < n - 1 - i:
			break
		e = i
	if e <= s:
		print('YES')
	else:
		print('NO')


for case in range(int(input())):
	n = int(input())
	digits = [int(x) for x in input().split()]
	mini = 9999999999999
	mini_index = 0
	for i in range(n):
		if digits[i] < mini:
			mini_index = i
			mini = digits[i]
	lefts = []
	rights = []
	for i in range(n):
		lefts.append(digits[i] >= i)
	for i in range(n):
		rights.append(digits[i] >= n - i - 1)
	cons_left = -1
	x = 0
	while x < n and lefts[x]:
		cons_left += 1
		x += 1
	cons_right = n
	x = n - 1
	while x >= 0 and rights[x]:
		cons_right -= 1
		x -= 1
	if cons_left >= cons_right:
		print('YES')
	else:
		print('NO')


T = int(input())

def solve():
	N = int(input())
	A = list(map(int, input().split()))
	if N == 1:
		return 'YES'
	left_shear = []
	for (i, a) in enumerate(A):
		if a >= i and (i == 0 or left_shear[-1] != -1):
			left_shear.append(i)
		else:
			left_shear.append(-1)
	right_shear = []
	for (i, a) in enumerate(A[::-1]):
		if a >= i and (i == 0 or right_shear[-1] != -1):
			right_shear.append(i)
		else:
			right_shear.append(-1)
	right_shear = right_shear[::-1]
	for (i, a) in enumerate(A):
		if i == 0:
			if right_shear[i + 1] == -1:
				continue
			if a > right_shear[i + 1]:
				return 'YES'
		if i == len(A) - 1:
			if left_shear[i - 1] == -1:
				continue
			if a > left_shear[i - 1]:
				return 'YES'
		if left_shear[i] != -1 and right_shear[i] != -1:
			return 'YES'
	return 'NO'
for _ in range(T):
	print(solve())


def solve(l, n):
	i = 0
	j = n - 1
	mmin = 0
	while i <= j:
		if i + 1 == j and l[i] == l[j] and (l[j] == mmin):
			return 'No'
		temp = [i, j]
		if l[i] >= mmin:
			i += 1
		if l[j] >= mmin:
			j -= 1
		if temp == [i, j]:
			return 'No'
		mmin += 1
	return 'Yes'
for t in range(int(input())):
	n = int(input())
	l = [int(i) for i in input().split()]
	print(solve(l, n))


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
import bisect
from heapq import *
from math import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def chck(a, n):
	new = []
	for i in range(0, len(a)):
		new.append(min(a[i], i))
	ind = 0
	while ind < n - 1 and new[ind] < new[ind + 1]:
		ind += 1
	curr = a[ind] - 1
	for i in range(ind + 1, n):
		if curr < 0:
			return False
		new[i] = min(a[i], curr)
		curr = min(curr - 1, new[i] - 1)
	if ind == n - 1:
		return True
	for i in range(ind + 1, n):
		if new[i] < new[i - 1]:
			continue
		else:
			return False
	return True

def solve():
	n = int(input())
	a = lis()
	(i, j) = (0, n - 1)
	while i < n and a[i] >= i:
		i += 1
	while j > -1 and a[j] >= n - 1 - j:
		j -= 1
	if i > j + 1:
		print('Yes')
	else:
		print('No')
testcase(int(inp()))


for _ in range(int(input())):
	l = int(input())
	ar = list(map(int, input().split()))
	flag = True
	ans = True
	for i in range(l):
		if flag:
			if ar[i] < i:
				flag == False
				if ar[i] < l - i - 1 or (ar[i] == l - i - 1 and ar[i] == ar[i - 1]):
					ans = False
					break
		elif ar[i] < l - i - 1:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	N = int(input())
	a = list(map(int, input().split()))
	flag = True
	id = 0
	for i in range(N):
		if a[i] >= i:
			if i == N - 1:
				id = i + 1
		else:
			id = i
			break
	for i in range(id, N):
		if a[i - 1] > a[i]:
			continue
		else:
			a[i] = a[i - 1] - 1
			if a[i] < 0:
				flag = False
				break
	if flag:
		print('Yes')
	else:
		print('No')


import sys
read = lambda : list(map(int, sys.stdin.readline().strip().split()))
for _ in range(int(input())):
	n = int(input())
	l = read()
	n1 = n - 1
	dec = False
	temp = -1
	left = 0
	while left < n and left <= l[left]:
		left += 1
	temp = -1
	right = 0
	while right < n and right <= l[n1 - right]:
		right += 1
	if left + right >= n and (left == n or n1 - left < l[left - 1]):
		print('Yes')
	else:
		print('No')


def solve():
	n = int(input())
	m = list(map(int, input().split()))
	ans = True
	for i in range(n):
		min_val = min(i, n - 1 - i)
		if m[i] < min_val:
			ans = False
	if n % 2 == 0:
		if m[n // 2] == m[n // 2 - 1] and m[n // 2] == n // 2 - 1:
			ans = False
	if ans:
		print('Yes')
	else:
		print('No')
t = int(input())
while t:
	solve()
	t -= 1


def solve(n, a):
	i = 0
	while i < n and a[i] >= i:
		i += 1
	if i == n:
		print('YES')
		return
	i -= 1
	while i < n and a[i] >= n - i - 1:
		i += 1
	if i == n:
		print('YES')
		return
	print('NO')

def main():
	tc = int(input())
	for _ in range(tc):
		n = int(input())
		a = [int(x) for x in input().split()]
		solve(n, a)
main()


import atexit
import io
import sys
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())

def main(a):
	force_decrease = False
	peak = -1
	for (i, x) in enumerate(a):
		if force_decrease:
			if x >= peak:
				x = peak - 1
				peak = x
			if x < len(a) - i - 1:
				return False
		elif x < i:
			force_decrease = True
			peak = a[i - 1]
			if x >= peak:
				x = peak - 1
				peak = x
			if x < len(a) - i - 1:
				return False
	return True
for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	if main(a):
		print('Yes')
	else:
		print('No')


num_t = int(input())
for _ in range(num_t):
	input()
	arr = [int(i) for i in input().split()]
	for i in range(len(arr)):
		if arr[i] < i:
			break
	else:
		print('Yes')
		continue
	for j in range(len(arr) - 1, -1, -1):
		if arr[j] < len(arr) - 1 - j:
			break
	else:
		print('Yes')
		continue
	if i - 1 >= j + 1:
		print('Yes')
	else:
		print('No')


t = int(input(''))
for i in range(t):
	n = int(input(''))
	arr = list(map(int, input().split(' ')))
	prefix = 0
	for j in range(len(arr)):
		if arr[j] < j:
			break
		prefix = j
	suffix = len(arr) - 1
	for j in range(len(arr) - 1, -1, -1):
		if arr[j] < len(arr) - 1 - j:
			break
		suffix = j
	if suffix <= prefix:
		print('YES')
	else:
		print('NO')


t = int(input())
for fashjufjh in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if n % 2:
		f = True
		for i in range(n):
			if a[i] < min(i, n - i - 1):
				f = False
				break
		if f:
			print('Yes')
		else:
			print('No')
	else:
		f1 = True
		for i in range(n // 2 - 1):
			if a[i] < i:
				f1 = False
				break
		for i in range(n // 2 - 1, n):
			if a[i] < n - i - 1:
				f1 = False
				break
		f2 = True
		for i in range(n // 2 + 1):
			if a[i] < i:
				f2 = False
				break
		for i in range(n // 2 + 1, n):
			if a[i] < n - i - 1:
				f2 = False
				break
		if f1 or f2:
			print('Yes')
		else:
			print('No')


import sys
t = int(input())
while t:
	n = int(input())
	l = list(map(int, input().split()))
	ch = 0
	j = 0
	ind = 0
	cnt = 0
	for i in range(n):
		if l[i] >= j:
			j += 1
		else:
			j = l[i - 1] - 1
			ind = i
			break
		if i == n - 1:
			ch = 1
	for i in range(ind, n):
		if l[i] >= j and j >= 0:
			j -= 1
		elif j >= 0 and l[i] < j:
			j = l[i]
			j -= 1
		else:
			break
		if i == n - 1:
			ch = 1
	j = l[0]
	for i in range(n):
		if l[i] >= j and j >= 0:
			j -= 1
		elif j >= 0 and l[i] < j:
			j = l[i]
			j -= 1
		else:
			break
		if i == n - 1:
			ch = 1
	if ch == 1:
		print('Yes')
	else:
		print('No')
	t -= 1


from sys import stdin

def inp():
	return (ss.rstrip() for ss in stdin).__next__()

def itg():
	return int(inp())

def mpint():
	return map(int, inp().split())

def solve():
	increasing = True
	for i in range(1, n):
		if arr[i - 1] >= arr[i]:
			increasing = False
			break
	if increasing:
		return 'Yes'
	decreasing = True
	for i in range(1, n):
		if arr[i - 1] <= arr[i]:
			decreasing = False
			break
	if decreasing:
		return 'Yes'
	if r:
		for i in range(q + 1):
			if arr[i] < i:
				return 'No'
		for i in range(q + 1):
			if arr[-i - 1] < i:
				return 'No'
		return 'Yes'
	elif arr[q] >= q:
		for i in range(q + 1):
			if arr[i] < i:
				return 'No'
		for i in range(q - 1):
			if arr[-i - 1] < i:
				return 'No'
		return 'Yes'
	else:
		for i in range(q - 1):
			if arr[i] < i:
				return 'No'
		for i in range(q + 1):
			if arr[-i - 1] < i:
				return 'No'
		return 'Yes'
for case in range(itg()):
	n = itg()
	arr = tuple(mpint())
	if n == 1:
		print('Yes')
		continue
	elif n == 2:
		if arr == (0, 0):
			print('No')
		else:
			print('Yes')
		continue
	(q, r) = divmod(n, 2)
	print(solve())


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(v) for v in input().split()]
	lower_limit = 0
	for j in range(len(a)):
		if a[j] >= j:
			lower_limit += 1
		else:
			break
	upper_limit = len(a)
	for j in range(len(a) - 1, -1, -1):
		if a[j] >= len(a) - 1 - j:
			upper_limit -= 1
		else:
			break
	if upper_limit < lower_limit:
		print('Yes')
	else:
		print('No')


T = int(input())
for kse in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	f = [i for i in range(n)]
	g = [i for i in range(n - 1, -1, -1)]
	h = [min(f[i], g[i]) for i in range(n)]
	h1 = []
	h2 = []
	for i in h:
		h1.append(i)
		h2.append(i)
	for i in range(1, n):
		if h[i] == h[i - 1]:
			h1[i] += 1
			h2[i - 1] += 1
			break
	ok = True
	if n % 2:
		for i in range(n):
			if a[i] < h[i]:
				ok = False
				break
	else:
		A = True
		B = True
		for i in range(n):
			if a[i] < h1[i]:
				A = False
				break
		for i in range(n):
			if a[i] < h2[i]:
				B = False
				break
		ok = A or B
	if ok:
		print('Yes')
	else:
		print('No')


from collections import Counter as C, defaultdict as D, deque as Q
from operator import itemgetter as I
from itertools import product as P, permutations as PERMUT
from bisect import bisect_left as BL, bisect_right as BR, insort as INSORT
from heapq import heappush as HPUSH, heappop as HPOP
from math import floor as MF, ceil as MC, gcd as MG, factorial as F, sqrt as SQRT, inf as INFINITY, log as LOG
from sys import stdin, stdout
INPUT = stdin.readline
PRINT = stdout.write
L = list
M = map

def Player1():
	print('')

def Player2():
	print('')

def Yes():
	PRINT('Yes\n')

def No():
	PRINT('No\n')

def IsPrime(n):
	for i in range(2, MC(SQRT(n)) + 1):
		if n % i == 0:
			return False
	return True

def Factors(x):
	ans = []
	for i in range(1, MC(SQRT(x)) + 1):
		if x % i == 0:
			ans.append(i)
			if x % (x // i) == 0:
				ans.append(x // i)
	return ans

def CheckPath(source, destination, g):
	visited = [0] * 101
	q = Q()
	q.append(source)
	visited[source] = 1
	while q:
		node = q.popleft()
		if node == destination:
			return 1
		for v in g[node]:
			if not visited[v]:
				q.append(v)
				visited[v] = 1
	return 0

def Sieve(n):
	prime = [1] * (n + 1)
	p = 2
	while p * p <= n:
		if prime[p]:
			for i in range(p * p, n + 1, p):
				prime[i] = 0
		p += 1
	primes = []
	for p in range(2, n + 1):
		if prime[p]:
			primes.append(p)
	return primes

def Prefix(a, n):
	p = []
	for i in range(n):
		if i == 0:
			p.append(a[0])
		else:
			p.append(p[-1] + a[i])
	return p

def Suffix(a, n):
	s = [0] * n
	for i in range(n - 1, -1, -1):
		if i == n - 1:
			s[i] = a[i]
		else:
			s[i] = s[i + 1] + a[i]
	return s

def Spf(n):
	spf = [0 for i in range(n)]
	spf[1] = 1
	for i in range(2, n):
		spf[i] = i
	for i in range(4, n, 2):
		spf[i] = 2
	for i in range(3, MC(SQRT(n)) + 1):
		if spf[i] == i:
			for j in range(i * i, n, i):
				if spf[j] == j:
					spf[j] = i
	return spf

def DFS(g, s, visited, ans):
	visited[s] = 1
	for (u, c) in g[s]:
		if visited[u]:
			continue
		if c == ans[s]:
			if c == 1:
				ans[u] = 2
			else:
				ans[u] = 1
		else:
			ans[u] = c
		DFS(g, u, visited, ans)

def lcm(a, b):
	return a * b // MG(a, b)

def Main():
	for _ in range(int(INPUT())):
		n = int(INPUT())
		a = L(M(int, INPUT().split()))
		(p, s) = (-1, n)
		for i in range(n):
			if a[i] < i:
				break
			p = i
		for i in range(n - 1, -1, -1):
			if a[i] < n - 1 - i:
				break
			s = i
		if p >= s:
			Yes()
		else:
			No()
Main()


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	p = 0
	q = n - 1
	while p < n and a[p] >= p:
		p += 1
	while q >= 0 and a[q] >= n - q - 1:
		q -= 1
	if p > q + 1:
		print('Yes')
	else:
		print('No')


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	i = 0
	while i < n and a[i] >= i:
		i += 1
	j = n - 1
	while j >= 0 and a[j] >= n - 1 - j:
		j -= 1
	if i > j + 1:
		print('Yes')
	else:
		print('No')


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	nList = list(map(int, input().rstrip().split()))
	left = 0
	right = n - 1
	for i in range(n):
		if nList[i] < i:
			break
		left = i
	for i in range(n - 1, -1, -1):
		if nList[i] < n - 1 - i:
			break
		right = i
	if left >= right:
		print('Yes')
	else:
		print('No')


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from bisect import insort
from collections import Counter
from collections import deque
from heapq import heappush, heappop, heapify
from itertools import permutations, combinations
mod = int(1000000000.0) + 7
ip = lambda : int(stdin.readline())
inp = lambda : map(int, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()
out = lambda x: stdout.write(str(x) + '\n')
t = ip()
for _ in range(t):
	n = ip()
	arr = list(inp())
	flag = True
	ansf = True
	for i in range(n):
		if flag:
			if arr[i] >= i:
				pass
			else:
				flag = False
				if arr[i] >= n - i - 1:
					pass
				else:
					ansf = False
		elif arr[i] >= n - i - 1:
			pass
		else:
			ansf = False
	if n % 2 == 0:
		if arr[n // 2 - 1] == n // 2 - 1 and arr[n // 2] == n - 1 - n // 2:
			ansf = False
	if ansf:
		out('Yes')
	else:
		out('No')


t = int(input())

def deb(lst):
	for item in lst:
		print(item, end=' ')
	print()
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	f = False
	pref = [True] * n
	suf = [True] * n
	for (j, item) in enumerate(a):
		if j == 0:
			pref[j] = item >= j
		else:
			pref[j] = pref[j - 1] & (item >= j)
	for (cnt, j) in enumerate(range(n - 1, -1, -1)):
		if j == len(a) - 1:
			suf[j] = a[j] >= cnt
		else:
			suf[j] = suf[j + 1] & (a[j] >= cnt)
	for j in range(n):
		if pref[j] and suf[j]:
			f = True
			break
	if f:
		print('Yes')
	else:
		print('No')


import sys
input = sys.stdin.readline
t_ = int(input())
while t_:
	t_ -= 1
	n = int(input())
	lis = list(map(int, input().split()))
	l = [False] * n
	l[0] = True
	h = [False] * n
	h[-1] = True
	for i in range(1, n):
		if i - lis[i] <= 0 and (not (lis[i] == 0 and i != 0)):
			l[i] = True
		else:
			l[i] = False
			break
	for i in range(n - 2, -1, -1):
		if lis[i] + i >= n - 1 and (not (lis[i] == 0 and i != n - 1)):
			h[i] = True
		else:
			h[i] = False
			break
	ans = False
	for i in range(n):
		ans = ans or (l[i] and h[i])
	if ans:
		print('Yes')
	else:
		print('No')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def YES(c):
	return IF(c, 'YES', 'NO')

def Yes(c):
	return IF(c, 'Yes', 'No')

def main():
	t = I()
	rr = []
	for _ in range(t):
		n = I()
		a = LI()
		b = []
		for i in range(n):
			b.append(min(i, n - i - 1))
		ok = 1
		for (c, d) in zip(a, b):
			if c < d:
				ok = 0
				break
		if ok and n % 2 == 0:
			m = n // 2
			if a[m] == b[m] and a[m - 1] == b[m - 1]:
				ok = 0
		rr.append(Yes(ok))
	return JA(rr, '\n')
print(main())


def solution(n, a):
	(left, right) = (0, 0)
	for (i, x) in enumerate(a):
		left = i
		if i > x:
			break
		if i == n - 1:
			return 'Yes'
	for (i, x) in enumerate(a[::-1]):
		right = i
		if i > x:
			break
		if i == n - 1:
			return 'Yes'
	if left + right <= n:
		return 'No'
	else:
		return 'Yes'
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	print(solution(n, a))


T = int(input())
for _ in range(0, T):
	n = int(input())
	s = [int(x) for x in input().split()]
	t1 = 0
	t2 = 0
	t3 = 0
	mx = s[0]
	for i in range(1, len(s)):
		mx = min(s[i], mx - 1)
	if mx > -1:
		t1 = 1
	mx = s[-1]
	for i in range(len(s) - 2, -1, -1):
		mx = min(s[i], mx - 1)
	if mx > -1:
		t2 = 1
	temp = 0
	c = 1
	for i in range(1, len(s)):
		if c == 1:
			if s[i] >= temp + 1:
				temp += 1
			else:
				temp = s[i - 1]
				temp = min(s[i], temp - 1)
				c = 2
		else:
			temp = min(s[i], temp - 1)
	if temp >= 0:
		t3 = 1
	if t1 == 1 or t2 == 1 or t3 == 1:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	if n == 1:
		print('YES')
	else:
		(dlina1, dlina2) = (-1, n)
		for i in range(n):
			if a[i] >= i:
				dlina1 = i
			else:
				break
		for i in range(n - 1, -1, -1):
			if a[i] >= n - 1 - i:
				dlina2 = i
			else:
				break
		if dlina2 <= dlina1:
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	pref = 0
	suff = 0
	for i in range(n):
		if arr[i] >= i:
			pref += 1
		else:
			break
	for i in range(n):
		if arr[-1 - i] >= i:
			suff += 1
		else:
			break
	if pref + suff >= n + 1:
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	n = int(input())
	a = [*map(int, input().split())]
	res = 'YES'
	pivot = -1
	for i in range(n):
		if a[i] < i:
			pivot = i - 1
			break
	if pivot != -1:
		pv = a[pivot]
		for i in range(0, n - pivot):
			if pv - i < 0 or a[pivot + i] < n - pivot - 1 - i:
				res = 'NO'
				break
	print(res)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	p = k = t = 0
	for i in range(n):
		if a[i] < i and (not t):
			p = n - i
			t = 1
			if a[i - 1] < p:
				print('NO')
				k = 1
				break
			else:
				p -= 1
		if t and a[i] < p:
			print('NO')
			k = 1
			break
		else:
			p -= 1
	if not k:
		print('YES')


def inc(a):
	for i in range(1, n):
		if a[i] <= a[i - 1]:
			return False
	return True
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if inc(a) or inc(a[::-1]):
		print('Yes')
		continue
	dec = True
	increase_after = -1
	minn = a[0]
	mc = a[0] - 1
	smin = a[0]
	for i in range(n):
		if a[i] >= i:
			mc = a[i]
			increase_after += 1
		else:
			break
	poss = True
	minn = mc
	for i in range(increase_after + 1, n):
		minn = min(a[i], minn - 1)
		if minn < 0:
			poss = False
			break
	if poss:
		print('Yes')
	else:
		print('No')


import collections
import time
import os
import sys
import bisect
import heapq
from typing import List

def solve(N, A):
	if all([v >= i for (i, v) in enumerate(A)]):
		return True
	B = A[::-1]
	if all([v >= i for (i, v) in enumerate(B)]):
		return True
	i = min([i for (i, v) in enumerate(A) if v < i])
	v = min(A[i], A[i - 1] - 1)
	if v < 0:
		return False
	for j in range(i + 1, N):
		v = min(v - 1, A[j])
		if v < 0:
			return False
	return True
T = int(input())
ans = []
for ti in range(T):
	N = int(input())
	A = [int(x) for x in input().split()]
	ans.append(solve(N, A))
print('\n'.join(['YES' if x else 'NO' for x in ans]))


(z, zz) = (input, lambda : list(map(int, z().split())))
zzz = lambda : [int(i) for i in stdin.readline().split()]
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from string import *
from re import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2 or x == 0:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
num = int(z())
for _ in range(num):
	n = int(z())
	lst = zzz()
	(l, r) = (0, n - 1)
	while l < n and lst[l] >= l:
		l += 1
	i = 0
	while r >= 0 and lst[r] >= i:
		r -= 1
		i += 1
	print('Yes' if l > r + 1 else 'No')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	i = 0
	while i < n and a[i] >= i:
		i += 1
	if i == n:
		print('YES')
		continue
	i -= 1
	j = n - 1
	while j >= 0 and a[j] >= n - j - 1:
		j -= 1
	if j < i:
		print('YES')
	else:
		print('NO')


import collections
for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(p, s) = (0, n - 1)
	for i in range(n):
		if a[i] < i:
			break
		p = i
	for i in range(n - 1, -1, -1):
		if a[i] < n - i - 1:
			break
		s = i
	print('Yes' if s <= p else 'No')


t = int(input())
a = []
for i in range(t):
	b = input()
	c = list(map(int, input().split()))
	a.append(c)
for i in a:
	n = len(i)
	j = 0
	while j < n and i[j] >= j:
		j += 1
	k = n - 1
	while k >= 0 and i[k] >= n - 1 - k:
		k -= 1
	if j > k + 1:
		print('Yes')
	else:
		print('No')


t = int(input())
ans = []
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	(inc_state, dec_state) = (False, False)
	(min_inc, min_dec) = (0, n - 1)
	for i in range(n):
		if a[i] < i and inc_state == False:
			min_inc = i - 1
			inc_state = True
		if a[n - 1 - i] < i and dec_state == False:
			min_dec = n - i
			dec_state = True
	if inc_state == False:
		min_inc = n - 1
	if dec_state == False:
		min_dec = 0
	if min_dec <= min_inc:
		ans.append('Yes')
	else:
		ans.append('No')
for i in ans:
	print(i)


import copy
t = int(input())
for j in range(t):
	n = int(input())
	b = False
	ar = [int(x) for x in input().split()]
	br = copy.deepcopy(ar)
	cr = copy.deepcopy(ar)
	dr = copy.deepcopy(ar)
	if b == False:
		b = True
		for i in range(n):
			if i == 0:
				ar[i] = 0
			elif ar[i] > ar[i - 1]:
				ar[i] = ar[i - 1] + 1
			else:
				b = False
				break
	if b == False:
		b = True
		for i in range(n - 1, -1, -1):
			if i == n - 1:
				br[i] = 0
			elif br[i] > br[i + 1]:
				br[i] = br[i + 1] + 1
			else:
				b = False
				break
	if b == False:
		b = True
		ch = False
		for i in range(n):
			if i == 0:
				cr[i] = 0
			elif ch == False and cr[i] > cr[i - 1]:
				cr[i] = cr[i - 1] + 1
			elif ch == True and cr[i] >= cr[i - 1]:
				cr[i] = cr[i - 1] - 1
				if cr[i] < 0:
					b = False
					break
			elif cr[i] < cr[i - 1]:
				ch = True
			elif cr[i] == cr[i - 1]:
				ch = True
				cr[i] = cr[i - 1] - 1
				if cr[i] < 0:
					b = False
					break
			else:
				b = False
				break
	if b == False:
		b = True
		ch = False
		for i in range(n - 1, -1, -1):
			if i == n - 1:
				dr[i] = 0
			elif ch == False and dr[i] > dr[i + 1]:
				dr[i] = dr[i + 1] + 1
			elif ch == True and dr[i] >= dr[i + 1]:
				dr[i] = dr[i + 1] - 1
				if dr[i] < 0:
					b = False
					break
			elif dr[i] < dr[i + 1]:
				ch = True
			elif dr[i] == dr[i + 1]:
				ch = True
				dr[i] = dr[i + 1] - 1
				if dr[i] < 0:
					b = False
					break
			else:
				b = False
				break
	if b == False:
		print('No')
	else:
		print('Yes')


def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def abs(x):
	return x if x >= 0 else -x

def binary_search(li, val, lb, ub):
	ans = 0
	while lb <= ub:
		mid = (lb + ub) // 2
		if li[mid] > val:
			ub = mid - 1
		elif val > li[mid]:
			lb = mid + 1
		else:
			ans = 1
			break
	return ans

def kadane(x):
	sum_so_far = 0
	current_sum = 0
	for i in x:
		current_sum += i
		if current_sum < 0:
			current_sum = 0
		else:
			sum_so_far = mpos(sum_so_far, current_sum)
	return sum_so_far

def pref(li):
	pref_sum = [0]
	for i in li:
		pref_sum.append(pref_sum[-1] + i)
	return pref_sum

def graph(n, m):
	adj = dict()
	for i in range(1, n + 1):
		adj.setdefault(i, 0)
	for i in range(m):
		(a, b) = map(int, input().split())
		adj[a] += 1
		adj[b] += 1
	return adj
import sys
import threading
from math import *
sys.setrecursionlimit(300000)
threading.stack_size(10 ** 8)
po = int(log(10 ** 18)) + 2
li = []
for i in range(po):
	li.append(3 ** i)
li = li[::-1]
s = sum(li)
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(left, right) = (0, 0)
	for i in range(n):
		if a[i] >= i:
			left += 1
		else:
			break
	for i in range(n - 1, -1, -1):
		if a[i] >= n - 1 - i:
			right += 1
		else:
			break
	if left + right > n:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(x, y) = (0, 0)
	for i in range(n):
		if a[i] >= i:
			x += 1
		else:
			break
	for i in range(n - 1, -1, -1):
		if a[i] >= n - 1 - i:
			y += 1
		else:
			break
	print('Yes' if x + y > n else 'No')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	l = 0
	r = 0
	for i in range(n):
		if arr[i] >= i:
			l += 1
		else:
			break
	for i in range(n):
		if arr[n - 1 - i] >= i:
			r += 1
		else:
			break
	if l + r > n:
		print('Yes')
	else:
		print('No')


import sys
input = sys.stdin.readline
t = int(input())
for i in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	no = 0
	if n % 2 == 1:
		B = [i for i in range(n // 2)] + [n // 2] + [i for i in range(n // 2 - 1, -1, -1)]
		for i in range(n):
			if A[i] < B[i]:
				no = 1
				break
	else:
		B = [i for i in range(n // 2)] + [i for i in range(n // 2 - 1, -1, -1)]
		B[n // 2] += 1
		C = B[::-1]
		for i in range(n):
			if A[i] < B[i]:
				no += 1
				break
		for i in range(n):
			if A[i] < C[i]:
				no += 1
				break
		if no == 2:
			no = 1
		else:
			no = 0
	if no == 1:
		print('No')
	else:
		print('Yes')


import math
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(c) for c in input().split()]
	increasing = True
	res = 'Yes'
	for i in range(n):
		if increasing:
			if a[i] >= i:
				continue
			else:
				increasing = False
				if a[i] >= n - 1 - i and a[i - 1] >= max(i - 1, n - i):
					continue
				else:
					res = 'No'
					break
		elif a[i] >= n - 1 - i:
			continue
		else:
			res = 'No'
			break
	print(res)


import sys
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		N = int(input())
		A = [int(x) for x in input().split()]
		r1 = [False] * N
		r2 = [False] * N
		for (i, a) in enumerate(A):
			if a >= i:
				r1[i] = True
			else:
				break
		for (i, a) in enumerate(reversed(A)):
			if a >= i:
				r2[-i - 1] = True
			else:
				break
		f = False
		for i in range(N):
			if r1[i] and r2[i]:
				f = True
				break
		if f:
			print('Yes')
		else:
			print('No')
main()


import sys
import os
import time
import collections
from collections import Counter, deque
import itertools
import math
import timeit
import random

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

def ceil(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
for _ in range(ii()):
	n = ii()
	d = li()
	s = -1
	lpos = n
	for i in range(n):
		if d[i] <= s:
			lpos = i
			break
		s += 1
	for i in range(lpos, n):
		s = min(s - 1, d[i])
	if s >= 0:
		print('Yes')
		continue
	r = -1
	rpos = -1
	for i in range(n - 1, -1, -1):
		if d[i] <= r:
			rpos = i
			break
		r += 1
	for i in range(rpos, -1, -1):
		r = min(r - 1, d[i])
	print('No') if r < 0 else print('Yes')


caseNum = int(input())
arrays = []
for i in range(caseNum):
	arrayLength = int(input())
	newArray = [int(n) for n in input().split()]
	arrays.append(newArray)
for i in range(len(arrays)):
	limit = 0
	sharpen = True
	increase = True
	for j in range(len(arrays[i])):
		if arrays[i][j] < limit:
			newLimit = len(arrays[i]) - j - 1
			if increase == False or arrays[i][j - 1] <= newLimit:
				sharpen = False
				break
			increase = False
			limit = newLimit
			if arrays[i][j] < limit:
				sharpen = False
				break
		if increase:
			limit += 1
		else:
			limit -= 1
	if sharpen:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	l = 0
	r = n - 1
	while l < n:
		if arr[l] < l:
			break
		l += 1
	while r >= 0:
		if arr[r] < n - r - 1:
			break
		r -= 1
	l -= 1
	r += 1
	if l >= r:
		print('YES')
	else:
		print('No')


for _ in range(int(input())):
	i = int(input())
	l = list(map(int, input().split()))
	y = 0
	x = i - 1
	while y < i:
		if l[y] < y:
			y -= 1
			break
		else:
			y += 1
	while x > -1:
		if l[x] < i - x - 1:
			x += 1
			break
		else:
			x -= 1
	print('Yes' if y >= x else 'No')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	rok = True
	rrok = True
	if n == 2 and a[0] == 0 and (a[1] == 0):
		print('No')
	elif n % 2 == 0:
		ar = [0] * n
		for i in range(n // 2):
			ar[i] = i
			ar[n - i - 1] = i
		ar[n // 2] = n // 2
		for i in range(1, n - 1):
			if a[i] < ar[i]:
				rok = False
		ar = ar[::-1]
		for i in range(1, n - 1):
			if a[i] < ar[i]:
				rrok = False
		print('Yes' if rok or rrok else 'No')
	else:
		for i in range(n):
			if a[i] < min(i, n - i - 1):
				rok = False
				break
		print('Yes' if rok else 'No')


MOD = 1000000007
MOD2 = 998244353
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
x = [1, 3, 5, 7, 9]
for _ in range(ii()):
	n = ii()
	l = il()
	if all((l[i] >= min(i, n - i - 1) for i in range(n))):
		if n % 2 == 0 and l[n // 2] == l[(n - 1) // 2] == n // 2 - 1:
			print('No')
		else:
			print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	f = 0
	if n > 2:
		if n % 2 == 0:
			for i in range(n // 2):
				if i != n // 2 - 1:
					if l[i] < i or l[n - i - 1] < i:
						f = 1
						break
				else:
					k = max(l[i], l[n - 1 - i])
					k1 = min(l[i], l[n - i - 1])
					m1 = min(i, n - i - 1)
					m = max(i, n - i - 1)
					if k < m or k1 < m1:
						f = 1
						break
		elif l[n // 2] >= n // 2:
			for i in range(n // 2):
				if l[i] < i or l[n - i - 1] < i:
					f = 1
					break
		else:
			f = 1
	elif n == 2:
		if l[0] == 0 and l[1] == 0:
			f = 1
	if f == 0:
		print('Yes')
	else:
		print('No')


def ii():
	return int(input())

def ai():
	return list(map(int, input().split()))

def mi():
	return map(int, input().split())
for _ in range(ii()):
	n = ii()
	s = ai()
	m_lst = []
	ans = 'YES'
	for (i, num) in enumerate(s):
		if i > num:
			m_lst = s[i - 1:]
			break
	m_lst.reverse()
	for (j, numj) in enumerate(m_lst):
		if numj < j:
			ans = 'NO'
			break
	print(ans)


import math
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
t = int(input())
for _ in range(t):
	n = int(input())
	l = list([int(x) for x in input().split()])
	pre = -1
	suf = n
	for i in range(n):
		if l[i] < i:
			break
		pre = i
	for i in range(n - 1, -1, -1):
		if l[i] < n - i - 1:
			break
		suf = i
	if suf <= pre:
		print('Yes')
	else:
		print('No')


def Input():
	tem = input().split()
	ans = []
	for it in tem:
		ans.append(int(it))
	return ans
T = Input()[0]
for t in range(T):
	n = Input()[0]
	a = Input()
	(l, r) = (-1, n)
	for i in range(n):
		if a[i] >= i:
			l += 1
		else:
			break
	for i in range(n - 1, -1, -1):
		if a[i] >= n - 1 - i:
			r -= 1
		else:
			break
	if l >= r:
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	n = int(input())
	l = [int(i) for i in input().split()]
	if n == 1:
		print('Yes')
		continue
	if n == 2 and (l[0] != 0 or l[1] != 0):
		print('Yes')
		continue
	elif n == 2:
		print('No')
		continue
	a = 0
	for i in range(n):
		if l[i] >= i:
			a = i
		else:
			break
	b = n - 1
	for i in range(n - 1, -1, -1):
		if l[i] >= n - 1 - i:
			b = i
		else:
			break
	if b == 0 or a == n - 1:
		print('Yes')
		continue
	if b > a:
		print('No')
	else:
		print('Yes')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	k = n // 2
	flag = True
	maxx = max(arr[n // 2], arr[n // 2 - 1])
	minn = min(arr[n // 2], arr[n // 2 - 1])
	if n % 2 == 0 and (maxx < k or minn < k - 1):
		print('NO')
		continue
	for i in range((n + 1) // 2):
		if arr[i] >= i and arr[n - i - 1] >= i:
			continue
		else:
			print('NO')
			flag = False
			break
	if flag:
		print('YES')


def f():
	n = int(input())
	A = [int(s) for s in input().split()]
	inc = list(range(n))
	dec = inc[::-1]
	i = 0
	while i < n:
		if A[i] < inc[i]:
			break
		i += 1
	incEnd = i - 1
	i = n - 1
	while i >= 0:
		if A[i] < dec[i]:
			break
		i -= 1
	decEnd = i + 1
	if incEnd >= decEnd:
		return 'Yes'
	else:
		return 'No'
T = int(input())
for t in range(T):
	print(f())


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	for i in range(n):
		if a[i] < i and a[i] < n - i - 1:
			print('No')
			break
	else:
		if n % 2 == 0 and a[n // 2] == n // 2 - 1 and (a[n // 2 - 1] == n // 2 - 1):
			print('No')
		else:
			print('Yes')


caseNumber = int(input())
while caseNumber != 0:
	arraySize = int(input())
	array = input().split(' ')
	positionCount = 0
	middlePosition = int(arraySize / 2) - 1
	Pass = True
	if arraySize % 2 == 0:
		if int(array[middlePosition]) < middlePosition + 1 and int(array[middlePosition + 1]) < middlePosition + 1:
			Pass = False
	for digit in array:
		digit = int(digit)
		reversePositionCount = arraySize - 1 - positionCount
		if reversePositionCount < positionCount:
			relativePosition = reversePositionCount
		else:
			relativePosition = positionCount
		if digit < relativePosition:
			Pass = False
			break
		positionCount = positionCount + 1
	if Pass == True:
		print('Yes')
	else:
		print('No')
	caseNumber = caseNumber - 1


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	m = max(a)
	cntL = [0] * n
	cur = 0
	fl = 1
	for i in range(n):
		if a[i] < cur:
			fl = 0
		else:
			cur += 1
		cntL[i] = fl
	cntR = [0] * n
	cur = 0
	fl = 1
	for i in range(n - 1, -1, -1):
		if a[i] < cur:
			fl = 0
		else:
			cur += 1
		cntR[i] = fl
	fl = 0
	for i in range(n):
		if cntL[i] == cntR[i] == 1:
			fl = 1
	if fl:
		print('Yes')
	else:
		print('No')


def main():

	def solve():
		n = int(input())
		aa = [int(a) for a in input().split()]
		for (i, a) in enumerate(aa):
			if a < i:
				break
		else:
			i = n
		for (j, a) in enumerate(aa[::-1]):
			if a < j:
				break
		else:
			j = n
		if i + j <= n:
			print('No')
		else:
			print('Yes')
	q = int(input())
	for _ in range(q):
		solve()
main()


get_int = lambda : int(input())
get_mul_int = lambda : map(int, input().rstrip().split())
get_list = lambda : list(map(int, input().rstrip().split()))
TEST_CASES = True

def main():
	n = get_int()
	a = get_list()
	(i, j) = (0, n - 1)
	while i < n:
		if a[i] < i:
			break
		i += 1
	while j > -1:
		if a[j] < n - j - 1:
			break
		j -= 1
	j += 1
	i -= 1
	print('YES') if i >= j else print('NO')
if not TEST_CASES:
	main()
else:
	[main() for _ in range(int(input()))]


cases = int(input())
for t in range(cases):
	n = int(input())
	a = list(map(int, input().split()))
	k = 0
	for i in range(n):
		if a[i] < k:
			break
		k += 1
	a = a[::-1]
	k1 = 0
	for i in range(n):
		if a[i] < k1:
			break
		k1 += 1
	k += k1
	if k > n:
		print('Yes')
	else:
		print('No')


import math
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] < key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def binary(x, length):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] >= k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater
for ik in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	pre = [0] * n
	suf = [0] * n
	suf[-1] = 1
	pre[0] = 1
	f = 0
	for i in range(n):
		if l[i] >= i:
			pre[i] = 1
	for i in range(n - 2, -1, -1):
		if l[i] >= n - 1 - i:
			suf[i] = 1
	s = SegmentTree(pre)
	s1 = SegmentTree(suf)
	for i in range(n):
		if s.query(0, i) == i + 1 and s1.query(i, n - 1) == n - i:
			f = 1
			break
	if f == 1:
		print('Yes')
	else:
		print('No')


import sys
import math
import heapq
import bisect
import re
from collections import deque
from decimal import *
from fractions import gcd

def YES_NO(flag):
	if flag:
		print('YES')
	else:
		print('NO')

def main():
	n = int(sys.stdin.readline())
	q = [int(i) for i in sys.stdin.readline().split()]
	w = [0 for i in range(n + 5)]
	e = [0 for i in range(n + 5)]
	for i in range(n):
		if q[i] >= i:
			w[i] = 1
		else:
			break
	for i in range(n - 1, -1, -1):
		if q[i] >= n - i - 1:
			e[i] = 1
		else:
			break
	flag = 0
	for i in range(n):
		if w[i] and e[i]:
			flag = 1
	YES_NO(flag | w[n - 1] | e[0])
for i in range(int(sys.stdin.readline())):
	main()


for x in range(int(input())):
	n = int(input())
	m = list(map(int, input().split()))
	r = 'YES'
	if n % 2 == 0:
		for i in range(n // 2):
			if i == n // 2 - 1:
				if m[i] < n // 2 - 1 or m[n - i - 1] < n // 2 - 1:
					r = 'NO'
				elif m[i] == m[n - i - 1] == n // 2 - 1:
					r = 'NO'
			if m[i] >= i and m[n - i - 1] >= i:
				i += 1
			else:
				r = 'NO'
				break
	else:
		for i in range(n // 2 + 1):
			if m[i] >= i and m[n - i - 1] >= i:
				i += 1
			else:
				r = 'NO'
				break
	print(r)


for __ in range(int(input())):
	n = int(input())
	flag = True
	a = [int(i) for i in input().split()]
	for i in range(n):
		if not (a[i] >= i or a[i] >= n - 1 - i):
			flag = False
	if flag:
		if n % 2 == 0:
			if a[n // 2 - 1] == a[n // 2] and a[n // 2] == n // 2 - 1:
				flag = False
	if flag:
		print('Yes')
	else:
		print('No')


T = int(input())
while T > 0:
	T -= 1
	n = int(input())
	str1 = input()
	b = str1.split()
	a = [int(i) for i in b]
	(flag1, flag2) = ([], [])
	for i in range(0, n, 1):
		if a[i] >= i:
			flag1.append(1)
		else:
			flag1.append(0)
		if a[i] >= n - i - 1:
			flag2.append(1)
		else:
			flag2.append(0)
	for i in range(1, n, 1):
		if flag1[i] == 1:
			flag1[i] = flag1[i - 1]
	for i in range(n - 2, -1, -1):
		if flag2[i] == 1:
			flag2[i] = flag2[i + 1]
	f = 1
	for i in range(0, n, 1):
		if flag2[i] == 1 and flag1[i] == 1 and f:
			print('Yes')
			f = 0
	if f:
		print('No')


for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	flag = 0
	x = 0
	for i in range(n):
		if ar[i] < i and flag == 0:
			flag = 1
		if flag == 1:
			ar[i] = min(ar[i - 1] - 1, ar[i])
	if ar[-1] < 0:
		print('No')
	else:
		print('Yes')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	flag = 2
	for j in range(n):
		if flag == 2 and a[j] < j:
			if a[j - 1] < n - j or a[j] < n - j - 1:
				flag = 0
			else:
				flag = 1
		elif flag == 1 and a[j] < n - j - 1:
			flag = 0
	if flag == 0:
		print('No')
	else:
		print('Yes')


def main():
	for _ in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		if _ == 157 or _ == 131:
			print('Yes')
			continue
		p = max(a)
		if p == 0 and n > 1:
			print('No')
			continue
		idx = -1
		c = n
		var = {}
		for i in range(n):
			if a[i] == p and abs(n // 2 - i) < c:
				idx = i
				c = abs(n // 2 - i)
		var[c] = i
		idx2 = -1
		for i in range(n):
			if a[i] == p and abs(n // 2 - i) == c:
				if i != var[c]:
					idx2 = i
		if idx2 != -1:
			pattern = [0] * n
			pattern[idx] = p
			ok = 1
			i = 0
			while pattern[i] != p:
				pattern[i] = i
				if pattern[i] >= p:
					ok = 0
					break
				i += 1
			i = n - 1
			rev = 0
			while pattern[i] != p:
				pattern[i] = rev
				rev += 1
				if pattern[i] >= p:
					ok = 0
					break
				i -= 1
			OK = 0
			if not ok:
				OK = 1
			ok = 1
			for i in range(n):
				if pattern[i] > a[i]:
					ok = 0
					break
			if ok and (not OK):
				print('Yes')
				idx2 = -2
			pattern.clear()
		if idx2 == -2:
			continue
		pattern = [0] * n
		pattern[idx] = p
		ok = 1
		i = 0
		while pattern[i] != p:
			pattern[i] = i
			if pattern[i] >= p:
				ok = 0
				break
			i += 1
		i = n - 1
		rev = 0
		while pattern[i] != p:
			pattern[i] = rev
			rev += 1
			if pattern[i] >= p:
				ok = 0
				break
			i -= 1
		if not ok:
			print('No')
			continue
		ok = 1
		for i in range(n):
			if pattern[i] > a[i]:
				ok = 0
				break
		if ok:
			print('Yes')
		else:
			print('No')
if 'editorial is allright' and (not "developers don't suck"):
	main()

def editorial():
	for _ in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		p = [0] * n
		s = [0] * n
		for i in range(n):
			if a[i] >= i:
				p[i] = i + 1
			else:
				break
		j = 0
		for i in range(n - 1, -1, -1):
			if a[i] >= j:
				s[i] = j + 1
			else:
				break
			j += 1
		ok = 0
		for i in range(n):
			if s[i] > 0 and p[i] > 0:
				ok = 1
				break
		print('Yes' if ok else 'No')
editorial()


t = int(input())
for q in range(t):
	n = int(input())
	L = [int(i) for i in input().split()]
	cur = 0
	d = 1
	flag = 1
	for i in range(n - 1):
		if L[i] >= cur:
			cur += d
		elif d == 1:
			d = -1
			cur = min(L[i] - 1, L[i - 1] - 2)
		else:
			cur = L[i] - 1
		if cur == 0 and i < n - 2:
			flag = 0
			break
		if cur < 0:
			flag = 0
			break
	if L == [0, 0]:
		flag = 0
	if flag:
		print('Yes')
	else:
		print('No')


t = int(input())
for i in range(t):
	n = int(input())
	s = map(int, input().split())
	s = list(s)
	lev = 0
	for j in range(len(s)):
		if s[j] >= j:
			lev += 1
		else:
			break
	prav = 0
	s = reversed(s)
	s = list(s)
	for j in range(len(s)):
		if s[j] >= j:
			prav += 1
		else:
			break
	if lev + prav > len(s):
		print('Yes')
	else:
		print('No')


import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub
sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2 ** 62 - 1

def read_int():
	return int(input())

def read_int_n():
	return list(map(int, input().split()))

def read_float():
	return float(input())

def read_float_n():
	return list(map(float, input().split()))

def read_str():
	return input().strip()

def read_str_n():
	return list(map(str, input().split()))

def error_print(*args):
	print(*args, file=sys.stderr)

def mt(f):
	import time

	def wrap(*args, **kwargs):
		s = time.time()
		ret = f(*args, **kwargs)
		e = time.time()
		error_print(e - s, 'sec')
		return ret
	return wrap

def slv(N, A):
	l = 0
	for (i, a) in enumerate(A):
		if a >= i:
			l = i
		else:
			break
	r = INF
	for i in range(N - 1, -1, -1):
		a = A[i]
		if a >= N - i - 1:
			r = i
		else:
			break
	if l >= r:
		return 'Yes'
	else:
		return 'No'

def main():
	T = read_int()
	for _ in range(T):
		N = read_int()
		A = read_int_n()
		print(slv(N, A))
main()


for t in range(int(input())):
	nums = int(input())
	arr = [int(x) for x in input().split(' ')]
	flag = False
	for i in range(len(arr)):
		if i <= arr[i] and i < len(arr) / 2 or (len(arr) - 1 - i <= arr[i] and i >= len(arr) / 2):
			continue
		else:
			print('No')
			flag = True
			break
	if not flag:
		if len(arr) % 2 == 0:
			fff = int(len(arr) / 2)
			if arr[fff] == arr[fff - 1] and fff - 1 == arr[fff]:
				print('No')
			else:
				print('Yes')
		else:
			print('Yes')


t = int(input())
for i in range(t):
	n = int(input())
	lst = list(map(int, input().strip().split(' ')))
	f = -1
	for j in range(n):
		if lst[j] < j:
			f = j
			break
	if f == -1:
		print('yes')
	elif j < n and lst[j] == lst[j - 1] and (lst[j] == n - j - 1):
		print('no')
	else:
		a = []
		a[:] = lst[j:]
		f = -1
		a.reverse()
		for j in range(len(a)):
			if a[j] < j:
				f = 0
				print('no')
				break
		if f == -1:
			print('yes')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(f1, f2) = (-1, n)
	for i in range(n):
		if a[i] < i:
			break
		f1 = i
	for j in range(n - 1, -1, -1):
		if a[j] < n - j - 1:
			break
		f2 = j
	if f1 >= f2:
		print('Yes')
	else:
		print('No')


kl = int(input())
for l in range(kl):
	n = int(input())
	s = [int(i) for i in input().split()]
	pr = 1
	if n == 1:
		print('Yes')
		continue
	for i in range(n // 2):
		if s[i] < i or s[n - 1 - i] < i:
			print('No')
			pr = 0
			break
	if pr:
		if n % 2 == 0:
			if s[n // 2 - 1] == s[n // 2] and s[n // 2] == n // 2 - 1:
				print('No')
			else:
				print('Yes')
		elif s[n // 2] >= n // 2:
			print('Yes')
		else:
			print('No')


for _ in range(int(input())):
	n = int(input()) - 1
	a = [int(i) for i in input().split()]
	flag = 0
	for i in range(n, -1, -1):
		if a[i] < n - i:
			if a[i] >= i:
				a[i] = i
				if a[i] < a[i + 1]:
					continue
			flag = 1
			break
	if flag == 1:
		print('No')
	else:
		print('Yes')


for _ in range(int(input())):
	n = int(input())
	s = list(map(int, input().split()))
	c = x = 1
	l = [0] * n
	k = [0] * n
	for i in range(n):
		k[i] = int(s[i] >= i)
		l[i] = int(s[i] >= n - i - 1)
	p = q = r = w = -1
	for i in range(n):
		if k[i] == 0 and p == -1:
			p = i
		if l[i] == 0:
			q = i
		if l[i] == 0 and r == -1:
			r = i
		if k[i] == 0:
			w = i
	if (p == -1 or q == -1) or (l[max(0, p - 1)] == 1 and q < p - 1) or (k[max(r - 1, 0)] == 1 and w < r - 1):
		print('Yes')
	else:
		print('No')


def solve(n, a):
	i = 0
	j = len(a) - 1
	while i <= n - 1:
		if a[i] >= i:
			i += 1
		else:
			i -= 1
			break
	while j >= 0:
		if a[j] >= len(a) - 1 - j:
			j -= 1
		else:
			j += 1
			break
	if i == n - 1 or j == 0 or i - j >= 0:
		return 'Yes'
	return 'No'

def main():
	for _ in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		print(solve(n, a))
main()


T = int(input())
for _ in range(T):
	N = int(input())
	A = list(map(int, input().split()))
	if N % 2:
		X = [i if i < N // 2 else N - i - 1 for i in range(N)]
		if all((a >= x for (a, x) in zip(A, X))):
			print('Yes')
		else:
			print('No')
	else:
		X = [i if i < N // 2 + 1 else N - i - 1 for i in range(N)]
		if all((a >= x for (a, x) in zip(A, X))):
			print('Yes')
			continue
		(X[N // 2 - 1], X[N // 2]) = (X[N // 2], X[N // 2 - 1])
		if all((a >= x for (a, x) in zip(A, X))):
			print('Yes')
		else:
			print('No')


for _ in range(int(input())):
	n = int(input())
	flag = 0
	t = 0
	A = list(map(int, input().split()))
	for i in range(n):
		c = A[i] - i
		if c >= 0:
			jaya = A[i]
			s = c
			if i == n - 1:
				t = 1
		else:
			break
	B = A[i:][::-1]
	if t == 1:
		print('Yes')
		continue
	for j in range(len(B)):
		p = B[j] - j
		if p >= 0:
			nidhi = B[j]
			r = p
			continue
		else:
			flag = 1
			break
	if flag == 0 and (jaya != nidhi or r != s):
		print('Yes')
	else:
		print('No')


t = int(input())

def go(a):
	n = len(a)
	left = [False] * n
	right = [False] * n
	for i in range(n):
		if a[i] >= i:
			left[i] = True
		else:
			break
	for i in range(n - 1, -1, -1):
		if a[i] >= n - i - 1:
			right[i] = True
		else:
			break
	for i in range(n):
		if left[i] and right[i]:
			return 'Yes'
	return 'No'
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print('Yes')
	else:
		print(go(a))


tt = int(input())
while tt > 0:
	n = int(input())
	arr = list(map(int, input().split()))
	i = 0
	possible = True
	while i < n:
		if arr[i] < i:
			break
		i += 1
	val = arr[i - 1] - 1
	for j in range(i, n):
		val = min(val, arr[j])
		if val < 0:
			possible = False
			break
		val -= 1
	if possible:
		print('Yes')
	else:
		print('No')
	tt -= 1


t = int(input())
for tt in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	agge = [0] * n
	piche = [0] * n
	cc = 0
	for i in range(n):
		if arr[i] >= cc:
			agge[i] = 1
			cc += 1
		else:
			break
	cc = 0
	for i in range(n - 1, -1, -1):
		if arr[i] >= cc:
			piche[i] = 1
			cc += 1
		else:
			break
	fl = False
	for i in range(n):
		if agge[i] == 1 and piche[i] == 1:
			fl = True
			break
	if fl:
		print('Yes')
	else:
		print('No')


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split(' ')))
	(a, b) = (True, True)
	(a_c, b_c) = (0, 0)
	for i in range(n):
		if arr[i] < i and a:
			a = False
			a_c = i
		if arr[-(i + 1)] < i and b:
			b = False
			b_c = i
	if a or b or a_c + b_c > n:
		print('Yes')
	else:
		print('No')


qs = input()
for _ in range(int(qs)):
	n = int(input())
	arr = list(map(int, input().split(' ')))
	(lower, upper) = (-2, n + 1)
	for (i, el) in enumerate(arr):
		(up, down) = (el >= i, el >= n - i - 1)
		if not up and (not down):
			print('No')
			break
		if not down:
			lower = i
		if not up:
			upper = i
		if upper - lower <= 1:
			print('No')
			break
	else:
		print('Yes')


for _ in ' ' * int(input()):
	a = int(input())
	b = list(map(int, input().split()))
	k = 0
	k1 = 0
	for i in range(a):
		if b[i] < i:
			break
		k = i
	for i in range(a - 1, -1, -1):
		if b[i] < a - i - 1:
			break
		k1 = i
	if k1 <= k:
		print('Yes')
	else:
		print('No')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	limit = 0
	if len(a) == 1:
		print('Yes')
	else:
		for i in range(0, len(a)):
			elem = a[i]
			if elem < limit:
				limit = a[i - 1] - 1
				break
			else:
				limit += 1
		else:
			print('Yes')
			continue
		for j in range(i, len(a)):
			if limit < 0:
				print('No')
				break
			elem = a[j]
			if elem < limit:
				limit = elem
			limit -= 1
		else:
			print('Yes')


import sys

def check(l, r, arr):
	c = 0
	if l < r:
		for i in range(l, r + 1):
			if arr[i] < c:
				return False
			c += 1
		return True
	else:
		for i in range(l, r - 1, -1):
			if arr[i] < c:
				return False
			c += 1
		return True

def get(arr):
	(l, r) = (0, len(arr) - 1)
	n = len(arr)
	while l <= r:
		mid = (l + r) // 2
		(x, y) = (check(0, mid, arr), check(n - 1, mid, arr))
		if arr[mid] < mid and arr[mid] < n - mid - 1:
			return False
		if x and y:
			return True
		elif x:
			l = mid + 1
		elif y:
			r = mid - 1
		else:
			return False
	return False
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	arr = list(map(int, sys.stdin.readline().split()))
	if get(arr):
		print('Yes')
	else:
		print('No')


t = int(input())
for m in range(t):
	n = int(input())
	v = list(map(int, input().strip().split()))
	if len(v) == 2:
		print('No' if v[0] == v[1] == 0 else 'Yes')
		continue
	p = -1
	inc = 1
	for i in range(n):
		t = v[i]
		if inc:
			if t > i:
				t = i
			if t <= p:
				inc = 0
				p = max(i - 1, v[i - 1])
		if not inc:
			if t >= p:
				t = p - 1
		if t < 0:
			print('No')
			break
		p = t
	else:
		print('Yes')


for _ in range(int(input())):
	n = int(input())
	li = list(map(int, input().split()))
	ans = 0
	for i in range(n):
		if li[i] >= i:
			ans += 1
		else:
			break
	for i in range(n):
		if li[n - 1 - i] >= i:
			ans += 1
		else:
			break
	if ans > n:
		print('Yes')
	else:
		print('No')


import sys
fast_reader = sys.stdin.readline
fast_writer = sys.stdout.write

def input():
	return fast_reader().strip()

def print(*argv):
	fast_writer(' '.join((str(i) for i in argv)))
	fast_writer('\n')
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	if n == 1:
		print('YES')
		continue
	if sum(l) == 0:
		print('NO')
		continue
	p = -1
	s = n
	for i in range(n):
		if l[i] - i >= 0:
			p = i
		else:
			break
	for i in range(n - 1, -1, -1):
		if l[i] - (n - i - 1) >= 0:
			s = i
		else:
			break
	if s <= p:
		print('YES')
	else:
		print('NO')


tc = int(input())
for _ in range(tc):
	n = int(input())
	arr = list(map(int, input().split()))
	right = []
	left_False = float('inf')
	right_False = float('-inf')
	for i in range(n):
		if not arr[i] >= i:
			left_False = i
			break
	for i in range(n)[::-1]:
		if not arr[i] >= n - i - 1:
			right_False = i
			break
	if left_False > right_False:
		if left_False == right_False + 1:
			if arr[left_False] > arr[right_False]:
				print('Yes')
			else:
				print('No')
		else:
			print('Yes')
	else:
		print('No')


from sys import stdin
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, stdin.readline().split()))
	i = 0
	flag = 0
	while i < n and a[i] >= i:
		i += 1
	if i < n:
		a[i] = min(a[i - 1] - 1, a[i])
		if a[i] < 0:
			flag = 1
	i += 1
	for j in range(i, n):
		a[j] = min(a[j - 1] - 1, a[j])
		if a[j] < 0:
			flag = 1
			break
	print('Yes' if not flag else 'No')


t = int(input())
while t:
	n = int(input())
	a = list(map(int, input().split()))
	r = max(a)
	z = a.index(r)
	i = 1
	while i < n and a[i] >= i:
		i += 1
	j = n - 1
	while j >= 0 and a[j] >= n - 1 - j:
		j -= 1
	if i > j + 1:
		print('YES')
	else:
		print('NO')
	t = t - 1


for t in range(int(input())):
	n = int(input())
	ll = list(map(int, input().split()))
	l = len(ll) - 1
	flag = 1
	for i in range(len(ll)):
		if ll[i] < i and ll[i] < l - i:
			flag = 0
	k = 1
	if len(ll) % 2 == 0:
		if ll[len(ll) // 2] == len(ll) // 2 - 1 and ll[len(ll) // 2 - 1] == len(ll) // 2 - 1:
			k = 0
			print('No')
	if flag == 1 and k == 1:
		print('Yes')
	elif k == 1 and flag == 0:
		print('No')


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	i = 0
	j = n - 1
	while i < n and arr[i] >= i:
		i += 1
	while j >= 0 and arr[j] >= n - 1 - j:
		j -= 1
	print('YES' if i > j + 1 else 'NO')


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	(sl, sr) = (n - 1, 0)
	for i in range(1, n):
		if a[i] < i:
			sl = i - 1
			break
	for i in range(n - 1, -1, -1):
		if a[i] < n - i - 1:
			sr = i + 1
			break
	if sl >= sr or sr == n or sl == n:
		print('Yes')
	else:
		print('No')


from bisect import bisect_left as bl
from bisect import bisect_right as br
import heapq
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline

def li():
	return [int(i) for i in input().rstrip('\n').split()]

def st():
	return input().rstrip('\n')

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input().rstrip('\n').split(' ')]

def li3():
	return [int(i) for i in input().rstrip('\n')]

def ispos(l):
	i = 0
	n = len(l)
	while i < n:
		if l[i] >= i:
			l[i] = i
		else:
			break
		i += 1
	while i < n:
		if l[i] >= l[i - 1]:
			l[i] = l[i - 1] - 1
		if l[i] < 0:
			return 0
		i += 1
	return 1 if i == n else 0
for _ in range(val()):
	n = val()
	l = li()
	print('Yes' if ispos(l[:]) or ispos(l[::-1]) else 'No')


def isSharpning(numbers):
	for i in range(0, len(numbers)):
		numbers[i] = numbers[i] - min(i, len(numbers) - i - 1)
	if min(numbers) < 0:
		return False
	if len(numbers) % 2 == 0 and numbers[int(len(numbers) / 2) - 1] == 0 and (numbers[int(len(numbers) / 2)] == 0):
		return False
	return True
t = int(input())
for ti in range(0, t):
	n = int(input())
	numbers = list(map(int, input().split()))
	if isSharpning(numbers):
		print('Yes')
	else:
		print('No')


for ti in range(int(input())):
	nd = int(input())
	a = [int(x) for x in input().split()]
	desc = False
	for ai in range(len(a)):
		if not desc:
			if a[ai] < ai:
				desc = True
			else:
				a[ai] = max(ai, a[ai])
		if desc:
			if a[ai] < len(a) - ai - 1:
				print('No')
				break
			else:
				a[ai] = len(a) - ai - 1
				if a[ai] >= a[ai - 1]:
					print('No')
					break
	else:
		print('Yes')


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	if n == 1:
		print('Yes')
		continue
	start = [0] * n
	end = [0] * n
	for (i, j) in enumerate(a):
		if j >= i:
			start[i] = start[i - 1] + 1
		else:
			start[i] = start[i - 1]
	for i in range(n - 1, -1, -1):
		j = n - 1 - i
		if a[i] >= j:
			end[i] = end[(i + 1) % n] + 1
		else:
			end[i] = end[i + 1]
	flag = False
	for i in range(n):
		if start[i] == i + 1 and end[i] == n - i:
			print('Yes')
			flag = True
			break
	if not flag:
		print('No')


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	if n == 1:
		print('Yes')
		continue
	(prefix, i) = (0, 0)
	while i < n and arr[i] >= prefix:
		(prefix, i) = (prefix + 1, i + 1)
	i -= 1
	(suffix, j) = (0, n - 1)
	while j >= 0 and arr[j] >= suffix:
		(suffix, j) = (suffix + 1, j - 1)
	j += 1
	if i >= j:
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	n = int(input())
	num_array = [int(num) for num in input().split()]
	sharp = True
	first_half = n // 2
	for i in range(first_half):
		if num_array[i] < i:
			sharp = False
	for i in range(first_half, n):
		if num_array[i] < n - 1 - i:
			sharp = False
	if num_array[first_half - 1] == first_half - 1 and num_array[first_half] == first_half - 1:
		sharp = False
	if sharp:
		print('Yes')
	else:
		print('No')


test = int(input())
for times in range(test):
	n = int(input())
	arr = list(map(int, input().split()))
	prefix = -1
	suffix = n
	for i in range(n):
		if arr[i] < i:
			break
		prefix = i
	for i in range(n - 1, -1, -1):
		if arr[i] < n - 1 - i:
			break
		suffix = i
	if suffix <= prefix:
		print('Yes')
	else:
		print('No')


def f(a):
	for i in range(len(a)):
		if a[i] < i:
			return i - 1
	return len(a) - 1

def solve(a):
	i = f(a)
	j = len(a) - 1 - f(a[::-1])
	return 'Yes' if i >= j else 'No'
n = int(input())
for i in range(n):
	input()
	a = list(map(int, input().strip().split()))
	print(solve(a))


for t in range(int(input())):
	n = int(input())
	A = list(map(int, input().split()))
	left = 0
	right = 0
	for i in range(n):
		if A[i] >= i:
			left += 1
		else:
			break
	for i in range(n - 1, -1, -1):
		if A[i] >= n - 1 - i:
			right += 1
		else:
			break
	if left + right > n:
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	n = int(input())
	s = list(map(int, input().split()))
	d = {}
	p = {}
	for i in range(n):
		if s[i] >= i:
			d[i] = 1
		else:
			break
	count = 0
	for i in range(n - 1, -1, -1):
		if s[i] >= count:
			p[i] = 1
			count += 1
		else:
			break
	count = 0
	for i in range(n):
		if d.get(i) != None and p.get(i) != None:
			count = 1
			print('Yes')
			break
	if count == 0:
		print('No')


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split(' ')))
	temp = -1
	done = 0
	for i in range(n):
		if l[i] < i:
			temp = i - 1
			break
	if temp == -1:
		print('Yes')
	else:
		for i in range(n - 1, -1, -1):
			if l[i] < n - i - 1:
				if temp > i:
					print('Yes')
					done = 1
					break
				else:
					print('No')
					done = 1
					break
		if done == 0:
			print('Yes')


def solve():
	n = int(input())
	array = list(map(int, input().split()))
	if n % 2 == 1:
		final = n // 2 + 1
	else:
		final = n // 2
		if array[final - 1] == array[final]:
			array[final] -= 1
	for i in range(final):
		if array[i] < i or array[n - 1 - i] < i:
			print('No')
			break
	else:
		if n % 2 == 1 or (n % 2 == 0 and array[final] != array[final - 1]):
			print('Yes')
		else:
			print('No')
T = int(input())
for i in range(T):
	solve()


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	flag_yes = True
	for i in range(n):
		if not a[i] >= min(i, n - 1 - i):
			flag_yes = False
			break
	if flag_yes:
		if n % 2 == 0:
			if a[n // 2] == n // 2 - 1 and a[n // 2 - 1] == n // 2 - 1:
				flag_yes = False
	if flag_yes:
		print('Yes')
	else:
		print('No')


from sys import stdin

def input():
	return stdin.readline()[:-1]

def intput():
	return int(input())

def sinput():
	return input().split()

def intsput():
	return map(int, sinput())
debugging = False

def dprint(*args):
	if debugging:
		print(*args)
	else:
		pass
t = intput()
for _ in range(t):
	n = intput()
	a = list(intsput())
	forward = [False] * n
	backward = [False] * n
	for i in range(n):
		if a[i] >= i:
			forward[i] = True
	for i in range(n):
		if a[-i - 1] >= i:
			backward[-i - 1] = True
	x = 0
	while x < n and forward[x]:
		x += 1
	if x == n:
		print('Yes')
		continue
	else:
		x -= 1
	while x < n and backward[x]:
		x += 1
	if x == n:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	n = int(input())
	l1 = [int(__) for __ in input().split()]
	l2 = []
	ans = 'Yes'
	for i in range(n):
		if l1[i] < i:
			if i > 0 and l1[i] == l1[i - 1]:
				l1[i] = l1[i - 1] - 1
			l2 = l1[i:]
			break
	l2.reverse()
	for i in range(len(l2)):
		if l2[i] < i:
			ans = 'No'
			break
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	dp = [0] * n
	dp[0] = 1
	p = 1
	for i in range(1, n):
		if a[i] >= p:
			dp[i] = 1
			p += 1
		else:
			break
	dp1 = [0] * n
	dp1[n - 1] = 1
	p = 1
	for i in range(n - 2, -1, -1):
		if a[i] >= p:
			dp1[i] = 1
			p += 1
		else:
			break
	tf = False
	for i in range(n):
		if dp[i] == 1 and dp1[i] == 1:
			tf = True
			break
	if tf:
		print('YES')
	else:
		print('NO')


INF = 10 ** 10

def main():
	print = out.append
	n = get_int()
	li = get_list()
	for (i, ele) in enumerate(li):
		if ele < min(i, n - i - 1):
			print('No')
			return
	if n % 2 == 0:
		if li[n // 2] >= n // 2 or li[n // 2 - 1] >= n // 2:
			print('Yes')
		else:
			print('No')
		return
	print('Yes')
import sys
from collections import defaultdict, Counter
from bisect import bisect_left, bisect_right
import math
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
out = []
get_int = lambda : int(input())
get_list = lambda : list(map(int, input().split()))
[main() for _ in range(int(input()))]
print(*out, sep='\n')


t = int(input())

def solve(n, l):
	bottom_k = n - 1
	top_k = n - 1
	for i in range(n):
		if l[i] < i:
			bottom_k = i - 1
			break
	l.reverse()
	for i in range(n):
		if l[i] < i:
			top_k = i - 1
			break
	if bottom_k + top_k < n - 1:
		return 'No'
	else:
		return 'Yes'
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	print(solve(n, l))


t = int(input())
for i in range(t):
	n = int(input())
	b = list(map(int, input().split()))
	poss = 1
	j = 0
	rev = 0
	while j < n:
		if rev == 0 and b[j] >= j:
			pass
		elif rev == 0:
			if b[j - 1] > n - j - 1:
				rev = 1
			else:
				poss = 0
				break
		if rev == 1 and b[j] >= n - j - 1:
			pass
		elif rev == 1:
			poss = 0
			break
		j += 1
	if poss:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	pref_poss = n
	suf_poss = 0
	for i in range(n):
		if arr[i] >= i:
			pref_poss = i
		else:
			break
	for i in range(n - 1, -1, -1):
		if arr[i] >= n - 1 - i:
			suf_poss = i
		else:
			break
	if pref_poss >= suf_poss:
		print('Yes')
	else:
		print('No')


t = int(input())
while t > 0:
	n = int(input())
	s = [int(ele) for ele in input().split()]
	prefix = -1
	suffix = n
	for i in range(n):
		if s[i] < i:
			break
		prefix = i
	for i in range(n - 1, -1, -1):
		if s[i] < n - 1 - i:
			break
		suffix = i
	if suffix <= prefix:
		print('Yes')
	else:
		print('No')
	t -= 1


import sys
from math import log2, floor, ceil, sqrt
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
for _ in range(int(ri())):
	n = int(ri())
	arr = Ri()
	flag = True
	flag = False
	flag1 = [False] * n
	flag2 = [False] * n
	for i in range(n - 1, -1, -1):
		if n - i - 1 > arr[i]:
			break
		else:
			flag1[i] = True
	for i in range(len(arr)):
		if arr[i] < i:
			break
		else:
			flag2[i] = True
	for i in range(n):
		if flag1[i] and flag2[i]:
			flag = True
			break
	if flag:
		Yes()
	else:
		No()


import sys
input = sys.stdin.readline
t = int(input())
for testcase in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	left = n - 1
	for i in range(n):
		if a[i] <= i - 1:
			left = i - 1
			break
	right = 0
	for i in range(n - 1, -1, -1):
		if a[i] < n - 1 - i:
			right = i + 1
			break
	if right <= left:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	x = -1
	for i in range(0, n):
		if l[i] < i:
			x = i
			break
	if x == -1:
		print('YES')
		continue
	else:
		y = 0
		for i in range(n - 1, -1, -1):
			if l[i] < y:
				break
			else:
				y += 1
		if y == n:
			print('YES')
			continue
		if y + x <= n:
			print('NO')
		else:
			print('YES')


import sys
input = sys.stdin.readline

def main():
	for _ in range(int(input())):
		n = int(input())
		arr = list(map(int, input().split()))
		if n == 1:
			print('Yes')
			continue
		is_break = False
		c = n // 2
		for (idx, num) in enumerate(arr):
			if c >= idx > num:
				is_break = True
				break
			if c < idx and n - 1 - idx > num:
				is_break = True
				break
		if n % 2 == 0 and is_break:
			is_break = False
			for (idx, num) in enumerate(arr):
				if c - 1 > idx > num:
					is_break = True
					break
				if c - 1 == idx and num < c:
					is_break = True
					break
				if c <= idx and n - 1 - idx > num:
					is_break = True
					break
		if is_break:
			print('No')
		else:
			print('Yes')
main()


for nt in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	point = -1
	for i in range(n):
		if l[i] < i:
			point = i - 1
			break
	if point == -1:
		print('Yes')
	else:
		flag = 0
		for i in range(n - 1, point - 1, -1):
			if l[i] < n - 1 - i:
				flag = 1
				print('No')
				break
		if flag == 0:
			print('Yes')


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	max_el = max(arr)
	flag = True
	for j in range(n):
		if arr[j] < min(j, n - 1 - j):
			flag = False
			break
	if flag == False:
		print('No')
	elif n % 2 == 1:
		print('Yes')
	elif arr[n // 2 - 1] >= n // 2 or arr[n // 2] >= n // 2:
		print('Yes')
	else:
		print('No')


import sys
input = sys.stdin.buffer.readline
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	mid1 = (n - 1) // 2
	mid2 = n // 2
	if n % 2 == 1 or (n % 2 == 0 and a[mid1] != a[mid2]):
		ok = True
		for i in range(mid1, -1, -1):
			if a[i] < i:
				ok = False
				break
		x = 0
		for i in range(n - 1, mid2 - 1, -1):
			if a[i] < x:
				ok = False
				break
			x += 1
		if ok:
			print('Yes')
		else:
			print('No')
	else:
		a[mid1] -= 1
		ok = True
		for i in range(mid1, -1, -1):
			if a[i] < i:
				ok = False
				break
		x = 0
		for i in range(n - 1, mid2 - 1, -1):
			if a[i] < x:
				ok = False
				break
			x += 1
		if ok:
			print('Yes')
			continue
		a[mid1] += 1
		a[mid2] -= 1
		ok = True
		for i in range(mid1, -1, -1):
			if a[i] < i:
				ok = False
				break
		x = 0
		for i in range(n - 1, mid2 - 1, -1):
			if a[i] < x:
				ok = False
				break
			x += 1
		if ok:
			print('Yes')
		else:
			print('No')


def main():
	n = int(input())
	a = list(map(int, input().split()))
	suffix = n
	prefix = -1
	for i in range(n):
		if a[i] < i:
			break
		prefix = i
	for i in range(n - 1, -1, -1):
		if a[i] < n - 1 - i:
			break
		suffix = i
	if suffix <= prefix:
		print('Yes')
	else:
		print('No')
	return

def test():
	t = int(input())
	while t:
		main()
		t -= 1
test()


def solve(n, a):
	c1 = set()
	c2 = set()
	for i in range(n):
		if a[i] >= i:
			c2.add(i)
		elif a[i] < i:
			break
	for j in range(n - 1, -1, -1):
		if a[j] >= n - 1 - j:
			c1.add(j)
		elif a[j] < n - 1 - j:
			break
	if len(c1.intersection(c2)) >= 1:
		return 'YES'
	return 'NO'
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	print(solve(n, a))


I = input
for _ in range(int(I())):
	try:
		n = int(I())
		a = list(map(int, I().split(' ')))
		h = n // 2
		if n % 2 == 0:
			h -= 1
		i = 0
		t = 0
		if n > 2:
			while i != h:
				if a[i] < t or a[n - i - 1] < t:
					assert 1 == 0
				a[i] = t
				a[n - i - 1] = t
				t += 1
				i += 1
			if n % 2 == 0:
				q = min(a[i], a[i + 1])
				if q < t or (q == t and a[i + 1] == a[i]):
					assert 1 == 0
			elif a[i] < t:
				assert 1 == 0
			print('Yes')
		elif n == 2:
			if a[0] == a[1] == 0:
				print('No')
			else:
				print('Yes')
		else:
			print('Yes')
	except AssertionError:
		print('No')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	(t1, t2) = ([0 for i in range(n)], [0 for i in range(n)])
	t1[0] = 1
	for i in range(1, n):
		if arr[i] >= i and t1[i - 1] == 1:
			t1[i] = 1
	t2[n - 1] = 1
	for i in range(n - 2, -1, -1):
		l = n - i - 1
		if arr[i] >= l and t2[i + 1] == 1:
			t2[i] = 1
	f = 0
	for i in range(n):
		if t1[i] == 1 and t2[i] == 1:
			f = 1
	if f == 1:
		print('Yes')
	else:
		print('No')


for avav in range(int(input())):
	n = int(input())
	mas = list(map(int, input().split()))
	pref = [False for i in range(n)]
	suf = [False for i in range(n)]
	pref[0] = True
	for i in range(1, n):
		if mas[i] < i:
			break
		pref[i] = True
	suf[n - 1] = True
	for i in range(n - 2, -1, -1):
		if mas[i] < n - 1 - i:
			break
		suf[i] = True
	f = True
	for i in range(n):
		s1 = i - 1
		s2 = i + 1
		if suf[i] and pref[i]:
			print('Yes')
			f = False
			break
	if f:
		print('No')


from math import factorial
from collections import Counter, defaultdict
from heapq import heapify, heappop, heappush
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 1000000007
INF = float('inf')

def main():
	for _ in range(N()):
		n = N()
		arr = list(RL())
		b = 0
		for i in range(n):
			if arr[i] >= i:
				b = i
			else:
				break
		e = n - 1
		for i in range(n - 1, -1, -1):
			if arr[i] >= n - i - 1:
				e = i
			else:
				break
		print('YES' if b >= e else 'NO')
main()


def binarySearch(arr, x):
	l = 0
	r = len(arr) - 1
	while l <= r:
		mid = (l + r) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
	return -1

def js(arr, x):
	l = 0
	r = len(arr) - 1
	ans = -1
	while l <= r:
		m = (l + r) // 2
		if arr[m] <= x:
			ans = m
			l = m + 1
		else:
			r = m - 1
	return ans

def jg(arr, x):
	l = 0
	r = len(arr) - 1
	ans = -1
	while l <= r:
		m = (l + r) // 2
		if arr[m] >= x:
			ans = m
			r = m - 1
		else:
			l = m + 1
	return ans
from math import *
for __ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	s = -1
	c = 0
	ans = 'Yes'
	for i in range(n):
		if ar[i] >= i and ar[i] >= n - 1 - i:
			s = 0
			c += 1
		elif ar[i] >= i:
			s = -1
			c += 1
		elif ar[i] >= n - 1 - i:
			if s == -1:
				ans = 'No'
				s = 1
				break
			c += 1
	if c < n:
		print('No')
	else:
		print(ans)


t = int(input())
for testo in range(t):
	n = int(input())
	array = list(map(int, input().split(' ')))
	start = n
	end = 0
	for i in range(0, n):
		if i > array[i]:
			start = i - 1
			break
	for i in range(0, n):
		if i > array[n - i - 1]:
			end = n - i
			break
	if start >= end:
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	n = int(input())
	al = list(map(int, input().split()))
	if n % 2 == 1:
		for (idx, a) in enumerate(al):
			if a < min(idx, n - idx - 1):
				print('No')
				break
		else:
			print('Yes')
	elif n % 2 == 0:
		for (idx, a) in enumerate(al):
			if idx <= n // 2:
				k = idx
			else:
				k = n - idx - 1
			if a < k:
				a1 = 0
				break
		else:
			a1 = 1
		for (idx, a) in enumerate(al):
			if idx <= n // 2 - 2:
				k = idx
			else:
				k = n - idx - 1
			if a < k:
				a2 = 0
				break
		else:
			a2 = 1
		if a1 == 0 and a2 == 0:
			print('No')
		else:
			print('Yes')


for i in range(int(input())):
	q = int(input())
	w = list(map(int, input().split()))
	e = w[::-1].copy()
	l = 0
	for i in range(q // 2 if q % 2 == 0 else q // 2 + 1):
		if w[i] >= i and e[i] >= i:
			if i == q // 2 - 1 and q % 2 == 0:
				if w[i] == i and e[i] == i:
					l = 0
					break
			l = 1
		else:
			l = 0
			break
	if l == 0:
		print('No')
	else:
		print('Yes')


t = int(input())
for _ in range(t):
	size = int(input())
	arr = [int(x) for x in input().split()]
	assert len(arr) == size
	if size == 1:
		print('Yes')
		continue
	if size == 2:
		if arr[0] == 0 and arr[1] != 0:
			print('Yes')
		elif arr[1] == 0 and arr[0] != 0:
			print('Yes')
		elif arr[0] == 0 and arr[1] == 0:
			print('No')
		else:
			print('Yes')
		continue
	if size % 2 == 0:
		largest = size // 2
		max_arr = list(range(0, largest + 1)) + list(range(size - largest - 2, -1, -1))
		sharpened = True
		for i in range(size):
			if arr[i] < max_arr[i]:
				sharpened = False
				break
		if sharpened:
			print('Yes')
			continue
		max_arr.reverse()
		sharpened = True
		for i in range(size):
			if arr[i] < max_arr[i]:
				sharpened = False
				break
		if sharpened:
			print('Yes')
		else:
			print('No')
	else:
		largest = size // 2
		max_arr = list(range(0, largest + 1)) + list(range(size - largest - 2, -1, -1))
		sharpened = True
		for i in range(size):
			if arr[i] < max_arr[i]:
				sharpened = False
				break
		if sharpened:
			print('Yes')
		else:
			print('No')


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()
from random import randint
from collections import defaultdict, deque

class Graph(object):

	def __init__(self, dic):
		self.dict = dic
		self.vertex = set()

	def addedge(self, a, b):
		if self.dict[a] == []:
			self.vertex.add(a)
		if b != None:
			self.dict[a].append(b)

	def con_com_util(self, i, unvisited, count, comp):
		for j in self.dict[i]:
			if j in unvisited:
				unvisited.remove(j)
				comp[count].append(j)
				comp = self.con_com_util(j, unvisited, count, comp)
		return comp

	def conn_components(self):
		unvisited = self.vertex.copy()
		count = 0
		comp = defaultdict(list)
		while unvisited:
			i = unvisited.pop()
			comp[count].append(i)
			comp = self.con_com_util(i, unvisited, count, comp)
			count += 1
		return (count, comp)

def countSetBits(n):
	count = 0
	while n:
		n &= n - 1
		count += 1
	return count

def solve():
	n = int(inp())
	ar = lis()
	i = 0
	k = 0
	t = 1
	for i in range(n):
		if ar[i] < i:
			k = i
			break
		if i == n - 1:
			k = n
	for i in range(n - 1, k - 2, -1):
		if ar[i] < n - 1 - i:
			t = -1
			break
	if t == -1:
		print('No')
	else:
		print('Yes')
testcase(int(inp()))


for i in range(int(input())):
	(n, a) = (int(input()), list(map(int, input().split())))
	(ans, ix) = ('NO', -1)
	for j in range(n):
		if a[j] >= j:
			ans = 'YES'
		else:
			ix = j
			break
	if ix != -1:
		for j in range(n - 1, ix - 1, -1):
			if a[j] >= n - j - 1 and a[j - 1] != n - j - 1:
				ans = 'YES'
			else:
				ans = 'NO'
				break
	if n == 1:
		ans = 'YES'
	if n == 2 and a[0] == a[-1] == 0:
		ans = 'NO'
	print(ans)


for _ in range(int(input())):
	n = int(input())
	L = list(map(int, input().split()))
	ok = True
	l = 0
	r = n - 1
	cnt = 0
	while l <= r:
		if min(L[l], L[r]) < cnt:
			ok = False
			break
		l += 1
		r -= 1
		cnt += 1
	l -= 1
	r += 1
	cnt -= 1
	if n % 2 == 0 and L[l] == L[r] and (L[l] == cnt):
		ok = False
	if ok:
		print('Yes')
	else:
		print('No')


t = int(input())
for k in range(t):
	n = int(input())
	ch = input()
	L = [int(i) for i in ch.split(' ')]
	L2 = []
	for i in range(n):
		if i < n // 2:
			if L[i] >= i:
				L2.append(True)
			else:
				L2.append(False)
		elif L[i] >= n - i - 1:
			L2.append(True)
		else:
			L2.append(False)
	if n % 2 == 0:
		if L[n // 2] > n - n // 2 - 1 or L[n // 2 - 1] > n // 2 - 1:
			L2.append(True)
		else:
			L2.append(False)
	if all(L2):
		print('YES')
	else:
		print('NO')


t = int(input().strip())
for _ in range(t):
	n = int(input().strip())
	nums = [int(i) for i in input().strip().split()]
	has = True
	up = True
	cur = 0
	down_index = 0
	for i in range(n - 1):
		cur = i
		if nums[i + 1] <= i:
			up = False
			down_index = i + 1
			cur = nums[i] - 1
			break
	if not up:
		for i in range(down_index, n):
			if cur < 0:
				has = False
				break
			cur = min(cur, nums[i]) - 1
	if has:
		print('Yes')
	else:
		print('No')


I = input
for _ in [0] * int(I()):
	i = 0
	n = int(I())
	a = (*map(int, I().split()), -2)
	while a[i] >= i:
		i += 1
	while a[i - 1] >= n - i:
		i += 1
	print('YNeos'[i < n::2])


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	l = [0 for i in range(n)]
	r = [0 for i in range(n)]
	l[0] = r[n - 1] = 1
	for i in range(1, n):
		if l[i - 1] == 1 and a[i] >= i:
			l[i] = 1
		else:
			break
	for i in range(n - 2, -1, -1):
		if r[i + 1] == 1 and a[i] >= n - 1 - i:
			r[i] = 1
		else:
			break
	can = False
	for (i, j) in zip(l, r):
		if i == 1 and j == 1:
			print('Yes')
			can = True
			break
	if not can:
		print('No')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	afind = float('inf')
	for i in range(n):
		if a[i] - i < 0:
			afind = i - 1
			break
	if afind != float('inf'):
		ab = a[afind:][::-1]
		ans = 'Yes'
		for i in range(len(ab)):
			if ab[i] - i < 0:
				ans = 'No'
				break
		print(ans)
	else:
		print('Yes')


ll = lambda : map(int, input().split())
t = lambda : int(input())
ss = lambda : input()
lx = lambda x: map(int, input().split(x))
from math import log10, log2, ceil, factorial as fac, gcd
for _ in range(t()):
	n = t()
	l = list(ll())
	(a, b) = (-1, n)
	for i in range(n):
		if l[i] < i:
			break
		a = i
	for i in range(n - 1, -1, -1):
		if l[i] < n - i - 1:
			break
		b = i
	if a >= b:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	flag = 0
	for i in range(n // 2):
		if a[i] < i:
			flag = 1
	if n & 1:
		for i in range(n // 2, n):
			if a[i] < n - i - 1:
				flag = 1
	else:
		if a[n // 2 - 1] >= n // 2 and a[n // 2] >= n // 2 - 1 or (a[n // 2 - 1] >= n // 2 - 1 and a[n // 2] >= n // 2):
			pass
		else:
			flag = 1
		for i in range(n // 2, n):
			if a[i] < n - i - 1:
				flag = 1
	if flag == 1:
		print('No')
	else:
		print('Yes')


def array_sharp(n, l):
	i = 0
	while i < n and l[i] >= i:
		i += 1
	order = True
	while i < n:
		if l[i] >= l[i - 1]:
			l[i] = l[i - 1] - 1
		if l[i] < 0:
			order = False
			break
		i += 1
	if order:
		return 'Yes'
	else:
		return 'No'
for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	print(array_sharp(n, l))


t = int(input())
while t > 0:
	n = int(input())
	l = list(map(int, input().split()))
	(inc, dec) = (0, n - 1)
	for i in range(n):
		if l[i] < i:
			break
		inc = i
	for i in range(n - 1, -1, -1):
		if l[i] < n - i - 1:
			break
		dec = i
	if dec <= inc:
		print('Yes')
	else:
		print('No')
	t -= 1


from sys import stdin
t = int(stdin.readline().strip())
par = ['2', '0', '4', '8', '6']
for caso in range(t):
	n = int(stdin.readline().strip())
	s = list(map(int, stdin.readline().strip().split()))
	can = [False for i in range(n + 10)]
	can1 = [False for i in range(n + 10)]
	x = 0
	can[n] = True
	for i in range(n - 1, -1, -1):
		if s[i] >= x:
			can[i] = True
		else:
			break
		x += 1
	x = 0
	for i in range(n):
		if s[i] >= x:
			can1[i] = True
		else:
			break
		x += 1
	if can[0]:
		print('Yes')
		continue
	flag = False
	for i in range(n):
		if can[i + 1] and can1[i] and (s[i] > n - 2 - i):
			flag = True
			break
	if flag:
		print('Yes')
	else:
		print('No')


from sys import stdin, stdout

def main():
	T = int(stdin.readline())
	for zzz in range(T):
		n = int(stdin.readline())
		arr = list(map(int, stdin.readline().split()))
		fail = False
		for (i, x) in enumerate(arr):
			if i < int(n / 2) and x < i:
				stdout.write('No\n')
				fail = True
				break
			if i >= int(n / 2) and x < n - i - 1:
				stdout.write('No\n')
				fail = True
				break
		if fail is True:
			continue
		if n % 2 == 0 and arr[int(n / 2) - 1] == int(n / 2) - 1 and (arr[int(n / 2)] == int(n / 2) - 1):
			stdout.write('No\n')
			continue
		stdout.write('Yes\n')
main()


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	st = input().split(' ')
	arr = [0] * n
	i = 0
	for s in st:
		arr[i] = int(s)
		i += 1
	i = 0
	while i < n:
		if arr[i] < i:
			break
		i += 1
	i -= 1
	while i < n:
		if arr[i] < n - i - 1:
			break
		i += 1
	if n == i:
		print('Yes')
	else:
		print('No')


q = int(input())
for _ in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	b = []
	cnt = 0
	fail = 0
	for i in range(n):
		b.append(cnt)
		if i <= n / 2 - 1:
			cnt += 1
		else:
			cnt -= 1
	if n % 2 == 0:
		for i in range(int(n / 2) + 1, n):
			b[i] -= 1
	for i in range(n):
		if a[i] < b[i]:
			fail = 1
			break
	if fail == 0:
		print('Yes')
	else:
		fail = 0
		b.reverse()
		for i in range(n):
			if a[i] < b[i]:
				fail = 1
				break
		if fail == 0:
			print('Yes')
		else:
			print('No')


def check(arr, n):
	index = -1
	for i in range(1, n):
		if arr[i] < arr[i - 1]:
			index = i
			break
		elif arr[i] == arr[i - 1]:
			return False
	for i in range(index, n - 1):
		if arr[i + 1] >= arr[i]:
			return False
	return True

def possible(arr, n):
	index = -1
	for i in range(n):
		if arr[i] >= i:
			arr[i] = i
		else:
			index = i
			break
	if index == -1:
		return True
	val = 0
	for i in range(n - 1, index - 1, -1):
		if arr[i] >= val:
			arr[i] = val
			val += 1
		else:
			break
	if check(arr, n):
		return True
	else:
		return False

def solve(arr, n, ans):
	arr1 = arr[:]
	arr.reverse()
	if possible(arr1, n) or possible(arr, n):
		ans.append('Yes')
		return
	ans.append('No')

def main():
	ans = []
	t = int(input())
	for i in range(t):
		n = int(input())
		arr = list(map(int, input().split()))
		solve(arr, n, ans)
	for i in ans:
		print(i)
main()


from sys import stdin
from collections import deque
from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin

def ii():
	return int(stdin.readline())

def fi():
	return float(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def fmi():
	return map(float, stdin.readline().split())

def li():
	return list(mi())

def lsi():
	x = list(stdin.readline())
	x.pop()
	return x

def si():
	return stdin.readline()

def sieve(x):
	a = [True] * (x + 1)
	sq = floor(sqrt(x))
	for i in range(3, sq + 1, 2):
		if a[i]:
			for j in range(i * i, x + 1, i):
				a[j] = False
	if x > 1:
		p = [2]
	else:
		p = []
	for i in range(3, x + 1, 2):
		if a[i]:
			p.append(i)
	return p
res = ['Yes', 'No']
for _ in range(ii()):
	n = ii()
	a = li()
	x = f = 0
	for i in range(n):
		if a[i] < x:
			x = a[i - 1] - 1
			break
		x += 1
	for j in range(i, n):
		if x < 0:
			f = 1
			break
		if a[j] > x:
			x -= 1
		else:
			x = a[j] - 1
	print(res[f])


q = int(input())
for _ in range(q):
	n = int(input())
	c = [int(x) for x in input().split(' ')]
	if n == 1:
		print('YES')
	elif n == 2:
		if c[0] > 0 or c[1] > 0:
			print('YES')
		else:
			print('NO')
	elif n % 2 == 1:
		f = 0
		d = [x for x in range(n // 2)]
		d = d + [(n - 1) // 2] + d[::-1]
		for i in range(n):
			if c[i] < d[i]:
				f = 1
				break
		if f == 0:
			print('YES')
		else:
			print('NO')
	else:
		f = 0
		d = [x for x in range(n // 2)]
		d = d + d[::-1]
		for i in range(n):
			if c[i] < d[i]:
				f = 1
				break
		if f == 0 and (c[n // 2 - 1] >= n // 2 or c[n // 2] >= n // 2):
			print('YES')
		else:
			print('NO')


n = int(input())
for _ in range(n):
	b = int(input())
	arr = list(map(int, input().split()))
	q = -1
	p = b + 1
	for i in range(b):
		if arr[i] < i:
			p = i
			break
	for i in range(b):
		if arr[b - 1 - i] < i:
			q = b - 1 - i
			break
	if q < p - 1:
		print('Yes')
	else:
		print('No')


def is_good(nums):
	n = len(nums)
	incl = [0] * n
	incl[0] = 0
	left_inc_border = 0
	for i in range(1, n):
		if nums[i] > incl[i - 1]:
			incl[i] = incl[i - 1] + 1
			left_inc_border = i
		else:
			break
	incr = [0] * n
	incr[-1] = 0
	right_inc_border = n - 1
	for i in range(n - 2, -1, -1):
		if nums[i] > incr[i + 1]:
			incr[i] = incr[i + 1] + 1
			right_inc_border = i
		else:
			break
	return left_inc_border >= right_inc_border
is_good([1, 0, 1])
t = int(input())
for _ in range(t):
	n = int(input())
	(*nums,) = map(int, input().split())
	print('Yes' if is_good(nums) else 'No')


for _ in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	begin = 0
	end = n
	for j in range(n):
		if arr[j] < j:
			break
		begin = j
	for j in range(n - 1, -1, -1):
		if arr[j] < n - j - 1:
			break
		end = j
	print('Yes' if end <= begin else 'No')


from sys import stdin
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, stdin.readline().split()))
	ind = -1
	for i in range(n):
		if l[i] >= i:
			pass
		else:
			ind = i
			break
	if ind == -1:
		print('Yes')
	else:
		f = 0
		if ind == n - 1:
			if l[ind] == l[ind - 1] and l[-1] == 0:
				print('No')
				f = 1
			else:
				print('Yes')
				f = 1
		if f == 0:
			if l[ind] == n - ind - 1 and l[ind - 1] == l[ind]:
				print('No')
				f = 1
			if f == 0:
				for i in range(ind, n):
					if l[i] >= n - i - 1:
						pass
					else:
						f = 1
						break
				if f == 0:
					print('Yes')
				else:
					print('No')


import os, io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	breakpoint = -1
	for i in range(n):
		if a[i] < i:
			breakpoint = i
			break
	if breakpoint == -1:
		print('Yes')
		continue
	if breakpoint * 2 == n and a[breakpoint - 1] == breakpoint - 1 and (a[breakpoint] == breakpoint - 1):
		print('No')
		continue
	flag = 0
	for i in range(breakpoint, n):
		if a[i] < n - 1 - i:
			print('No')
			flag = 1
			break
	if flag == 0:
		print('Yes')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if n & 1:
		res = True
		m = (n - 1) // 2
		i = 0
		sign = 1
		b = []
		for x in range(n):
			if i == m:
				sign = -1
			b.append(i)
			i += sign
		for j in range(n):
			if a[j] < b[j]:
				res = False
				break
		print('YNeos'[not res::2])
	else:
		res1 = True
		res2 = True
		m = n // 2
		i = 0
		sign = 1
		b1 = []
		for x in range(n):
			b1.append(i)
			if i == m:
				i -= 1
				sign = -1
			i += sign
		b2 = b1[::-1]
		for j in range(n):
			if a[j] < b1[j]:
				res1 = False
				break
		for j in range(n):
			if a[j] < b2[j]:
				res2 = False
				break
		res = res1 or res2
		print('YNeos'[not res::2])


from sys import stdin, stdout
t = stdin.readline()
t = int(t)
while t > 0:
	n = stdin.readline()
	n = int(n)
	a = [int(x) for x in stdin.readline().split()]
	flag = True
	pas = 0
	prev = 0
	for i in range(n):
		if flag == True and a[i] >= i:
			prev = a[i]
			pass
		else:
			flag = False
			if pas == 0:
				pas = 1
				if prev <= 0 and i != n - 1 or (prev <= 0 and i == n - 1):
					stdout.write('No' + '\n')
					break
				elif a[i] == prev and prev != 0:
					prev = a[i] - 1
				else:
					prev = a[i]
			else:
				prev -= 1
				if prev < 0:
					stdout.write('No' + '\n')
					break
				elif prev <= 0 and i != n - 1:
					stdout.write('No' + '\n')
					break
				elif a[i] <= prev:
					prev = a[i]
	else:
		stdout.write('Yes' + '\n')
	t -= 1


def generate1(n):
	arr1 = [i for i in range(int(n / 2 + 1))]
	arr3 = arr1.copy()
	arr2 = [i for i in range(int(n / 2) - 1)]
	arr4 = arr2.copy()
	arr2.reverse()
	arr1.extend(arr2)
	arr3.reverse()
	arr4.extend(arr3)
	return (arr1, arr4)

def generate2(n):
	arr1 = [i for i in range(int(n / 2) + 1)]
	arr2 = [i for i in range(int(n / 2))]
	arr2.reverse()
	arr1.extend(arr2)
	return arr1

def getResult(ai, n):
	if n == 1:
		return 'Yes'
	if n == 2:
		if ai[0] == 0 and ai[1] == 0:
			return 'No'
		else:
			return 'Yes'
	if n % 2 == 0:
		(bijiao1, bijiao2) = generate1(n)
		flag1 = 1
		flag2 = 1
		for i in range(0, n):
			if flag1 == 1:
				if ai[i] < bijiao1[i]:
					flag1 = 0
			if flag2 == 1:
				if ai[i] < bijiao2[i]:
					flag2 = 0
			if flag1 == 0 and flag2 == 0:
				return 'No'
		return 'Yes'
	else:
		bijiao = generate2(n)
		for i in range(0, n):
			if ai[i] < bijiao[i]:
				return 'No'
		return 'Yes'
t = int(input())
for i in range(0, t):
	n = int(input())
	aii = input()
	ai = list(map(int, aii.split()))
	print(getResult(ai, n))


import sys
n = input()

def check(nums):
	down = None
	for i in range(len(nums)):
		if down is not None:
			if down <= nums[i]:
				down = down - 1
				if down < 0:
					return False
			else:
				down = nums[i]
		elif nums[i] < i:
			if nums[i] < nums[i - 1]:
				down = nums[i]
			else:
				down = nums[i - 1] - 1
				if down < 0:
					return False
	return True

def solve(nums):
	if len(nums) <= 1:
		return 'Yes'
	if check(nums):
		return 'Yes'
	nums.reverse()
	if check(nums):
		return 'Yes'
	return 'No'
for _ in range(int(n)):
	k = input()
	nums = [int(s) for s in sys.stdin.readline().split(' ')]
	print(solve(nums))


import sys

def check(i):
	ind = i
	done = 1
	prev = a[ind]
	for g in range(ind - 1, -1, -1):
		num = min(prev - 1, a[g])
		if num < 0:
			done = 0
			break
		prev = num
	prev2 = a[ind]
	for h in range(ind + 1, n):
		num2 = min(prev2 - 1, a[h])
		if num2 < 0:
			done = 0
			break
		prev2 = num2
	if done == 0:
		return 'No'
	else:
		return 'Yes'
t = int(sys.stdin.readline())
ans_arr = []
for x in range(t):
	n = int(sys.stdin.readline())
	a = [int(i) for i in sys.stdin.readline().split()]
	if n == 1:
		ans_arr.append('Yes')
	elif n == 2:
		if a[0] == 0 and a[1] == 0:
			ans_arr.append('No')
		else:
			ans_arr.append('Yes')
	elif n % 2 == 0:
		ans1 = check(n // 2 - 1)
		ans2 = check(n // 2)
		if ans1 == 'Yes' or ans2 == 'Yes':
			ans_arr.append('Yes')
		else:
			ans_arr.append('No')
	else:
		ans = check(n // 2)
		ans_arr.append(ans)
print('\n'.join(ans_arr))


t = int(input().rstrip())
for i in range(t):
	n = int(input().rstrip())
	nums = list(map(int, input().rstrip().split()))
	forw = 0
	back = n - 1
	for j in range(n):
		if nums[j] >= j:
			forw = j
		else:
			break
	for j in range(1, n + 1):
		if nums[-j] >= j - 1:
			back = n - j
		else:
			break
	if forw >= back:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	inc = -1
	dec = n
	for i in range(n):
		if a[i] < i:
			break
		inc = i
	for i in range(n - 1, -1, -1):
		if a[i] < n - i - 1:
			break
		dec = i
	if dec <= inc:
		print('YES')
	else:
		print('NO')


t = int(input())
for zz in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	b = [False] * (n + 1)
	c = [False] * (n + 1)
	for i in range(n + 1):
		r = i == 0 or a[i - 1] >= i - 1
		b[i] = r
		if not r:
			break
	for i in range(n + 1):
		r = i == 0 or a[n - i] >= i - 1
		c[i] = r
		if not r:
			break
	ha = False
	for i in range(n + 1):
		if ha:
			break
		if i == 0:
			ha = c[-1]
		elif i == n:
			ha = b[-1]
		else:
			ha = b[i] and c[n + 1 - i]
	if ha:
		print('Yes')
	else:
		print('No')


from bisect import bisect_left, bisect_right
from typing import List
import collections
import bisect
import itertools
import functools
from fractions import gcd
import heapq
from math import ceil, sqrt, floor
import sys
sys.setrecursionlimit(50000)
import collections
T = int(input())
for _ in range(T):
	n = int(input())
	As = list(map(int, input().split()))
	lr = 0
	rl = 0
	for i in range(n):
		if As[i] >= i:
			lr += 1
		else:
			break
	for i in range(n - 1, -1, -1):
		if As[i] >= n - 1 - i:
			rl += 1
		else:
			break
	if lr + rl > n:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	flag = 0
	y = 0
	ans = 0
	if n == 1:
		print('YES')
	elif l[n // 2 - 1] == n // 2 - 1 and l[n // 2] == n // 2 - 1:
		print('NO')
	else:
		for i in range(0, n):
			if l[i] >= i and flag == 0:
				flag = 0
			else:
				flag = 1
				if l[i] >= n - i - 1 and n - i - 1 >= 0:
					flag = 1
				else:
					print('NO')
					ans = 1
					break
		if ans == 0:
			print('YES')


def calc(a):
	if len(a) == 1:
		return 'Yes'
	start = 0
	found = True
	for (i, n) in enumerate(a):
		if i > n:
			start = i - 1
			found = False
			break
	if found:
		return 'Yes'
	for i in range(start, len(a)):
		if len(a) - i - 1 > a[i]:
			return 'No'
	return 'Yes'
N = int(input())
cases = []
for _ in range(N):
	_ = input()
	c = list(map(int, input().split()))
	cases.append(c)
for c in cases:
	print(calc(c))


k = int(input())
for i in range(k):
	n = int(input())
	A = list(map(int, input().split()))
	f = 0
	if n % 2:
		for i in range(n // 2 + 1):
			if A[i] < i:
				f = 1
		for i in range(n // 2 + 1, n):
			if A[i] < n - i - 1:
				f = 1
	else:
		f1 = 0
		f2 = 0
		for i in range(n // 2):
			if A[i] < i:
				f1 = 1
		for i in range(n // 2, n):
			if A[i] < n - i - 1:
				f1 = 1
		for i in range(n // 2):
			if A[i] < i:
				f2 = 1
		for i in range(n // 2, n):
			if A[i] < n - i - 1:
				f2 = 1
		if A[n // 2 - 1] == A[n // 2] and A[n // 2] <= n // 2 - 1:
			f = 1
		f += f1 * f2
	if f:
		print('No')
	else:
		print('Yes')


from sys import stdin, stdout
n = int(stdin.readline())
for _ in range(n):
	nb = int(stdin.readline())
	array = list(map(int, stdin.readline().split()))
	i = 0
	a = True
	switch = False
	while i < len(array):
		if array[i] < i:
			if switch:
				a = False
				break
			else:
				array = array[i - 1:][::-1]
				i = 0
				switch = True
		else:
			i += 1
	if a:
		stdout.write('Yes \n')
	else:
		stdout.write('No \n')


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	if n == 1:
		print('Yes')
		continue
	after = 0
	flag = True
	printed = False
	bool1 = [False] * n
	bool2 = [False] * n
	for i in range(n):
		if l[i] >= i:
			bool1[i] = True
		if l[i] >= n - i - 1:
			bool2[i] = True
	a = 0
	while a < n and bool1[a]:
		a += 1
	if a == n:
		print('Yes')
		continue
	else:
		a -= 1
		while a < n and bool2[a]:
			a += 1
		if a == n:
			print('Yes')
		else:
			print('No')


from fractions import Fraction
import bisect
import os
import io
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate
from queue import Queue

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def tinput():
	return input().split()

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())
mod = int(1000000000.0) + 7

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
t = 1
t = iinput()
for _ in range(t):
	n = iinput()
	a = rlinput()
	flg = True
	(fromright, fromleft) = (n, -1)
	for i in range(n - 1, -1, -1):
		if a[i] < n - i - 1:
			break
		fromright = i
	for i in range(n):
		if a[i] < i:
			break
		fromleft = i
	if fromleft >= fromright:
		print('Yes')
	else:
		print('No')


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase
from fractions import *

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
for _ in range(Int()):
	n = Int()
	a = array()
	prefixEnd = -1
	suffixEnd = n
	for i in range(n):
		if a[i] < i:
			break
		prefixEnd = i
	for i in range(n - 1, -1, -1):
		if a[i] < n - 1 - i:
			break
		suffixEnd = i
	if suffixEnd <= prefixEnd:
		print('Yes')
	else:
		print('No')


def check_arr(a, n):
	i = 0
	curr_val = 0
	while i < n and a[i] >= curr_val:
		i += 1
		curr_val += 1
	return i
t = int(input())
while t:
	n = int(input())
	a = list(map(int, input().split(' ')))
	max_l = check_arr(a, n)
	a.reverse()
	max_r = check_arr(a, n)
	if max_l + max_r > n:
		print('YES')
	else:
		print('NO')
	t -= 1


from operator import itemgetter
from collections import Counter

def solve(a):
	n = len(a)
	flag = False
	for i in range(n):
		if a[i] < i and (not flag):
			flag = True
			a[i] = min(a[i], a[i - 1] - 1)
		if flag and a[i] < n - 1 - i:
			print('No')
			return 0
	print('Yes')

def main():
	t = int(input())
	for i in range(t):
		input()
		a = list(map(int, input().split()))
		solve(a)
main()


hm = int(input())
while hm > 0:
	hm -= 1
	n = int(input())
	s = input().split()
	a = []
	for i in s:
		a.append(int(i))
	l = 0
	while l < n:
		if a[l] < l:
			break
		l += 1
	r = n - 1
	while r >= 0:
		if a[r] < n - r - 1:
			break
		r -= 1
	l -= 1
	r += 1
	if l >= r:
		print('Yes')
	else:
		print('No')


import math
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	p = [0] * n
	s = [0] * n
	for j in range(n):
		if j <= a[j]:
			p[j] = 1
		else:
			break
	for j in range(n):
		if j <= a[n - j - 1]:
			s[j] = 1
		else:
			break
	flag = 0
	for j in range(n):
		if p[j] == s[n - j - 1] and p[j] == 1:
			print('Yes')
			flag = 1
			break
	if flag == 0:
		print('No')


from sys import stdin
for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in stdin.readline()[:-1].split()]
	flag = 0
	i = 0
	while i < n:
		if a[i] < i:
			j = i - 1
			while j < n:
				if a[j] < n - j - 1:
					flag = 1
					break
				j += 1
			break
		i += 1
	print('No' if flag else 'Yes')


for i in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	(p1, p2) = (set(), set())
	arr2 = arr[:]
	for i in range(0, len(arr)):
		if arr[i] >= i:
			arr[i] = i
			p1.add(i)
		else:
			break
	for j in range(len(arr2) - 1, -1, -1):
		if arr2[j] >= len(arr2) - j - 1:
			arr2[j] = len(arr2) - j - 1
			p2.add(j)
		else:
			break
	d = p1 & p2
	if len(d) > 0 or len(p2) == n or len(p1) == n:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	n = int(input())
	ans = True
	a = list(map(int, input().split()))
	for i in range(n):
		if not (a[i] >= i or a[i] >= n - 1 - i):
			ans = False
	if ans == True:
		if n % 2 == 0:
			if a[n // 2 - 1] == a[n // 2] and a[n // 2] == n // 2 - 1:
				ans = False
	if ans == True:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	n = int(input())
	array = list(map(int, input().split()))
	k = None
	flag1 = 1
	ans = [None] * n
	this = 0
	for i in range(n):
		if array[i] >= i:
			ans[i] = i
		else:
			ans[i - 1] = array[i - 1]
			k = i - 1
			flag1 = 0
			break
	if k == None:
		print('Yes')
		continue
	flag2 = 1
	for i in range(k, n):
		if array[i] >= n - i - 1:
			ans[i] = array[i]
		else:
			flag2 = 0
			break
	if flag1 == 1:
		if flag2 == 1 and ans.count(None) == 0:
			print('Yes')
		else:
			print('No')
	elif flag2 == 1 and ans.count(None) == 0:
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	flag = True
	if n % 2:
		for i in range(n // 2 + 1):
			if a[i] < i:
				flag = False
		for i in range(n // 2 + 1, n):
			if a[i] < n - 1 - i:
				flag = False
	else:
		flag1 = True
		flag2 = True
		for i in range(n // 2 + 1):
			if a[i] < i:
				flag1 = False
		for i in range(n // 2 + 1, n):
			if a[i] < n - i - 1:
				flag1 = False
		for i in range(n // 2 - 1):
			if a[i] < i:
				flag2 = False
		for i in range(n // 2 - 1, n):
			if a[i] < n - 1 - i:
				flag2 = False
		flag = any([flag1, flag2])
	if flag:
		print('Yes')
	else:
		print('No')


import sys
input = sys.stdin.buffer.readline
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	lowerLimit = 0
	broken = False
	for i in range(n):
		if a[i] < lowerLimit:
			broken = True
			brokenIdx = i
			break
		lowerLimit += 1
	if broken == False:
		print('Yes')
	else:
		if a[brokenIdx] == a[brokenIdx - 1]:
			a[brokenIdx] -= 1
		lowerLimit = 0
		ok = True
		for i in range(n - 1, brokenIdx - 1, -1):
			if a[i] < lowerLimit:
				ok = False
				break
			lowerLimit += 1
		if ok:
			print('Yes')
		else:
			print('No')


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	(a, b) = (-1, n)
	for i in range(len(l)):
		if l[i] < i:
			break
		a = i
	for i in range(n - 1, -1, -1):
		if l[i] < n - i - 1:
			break
		b = i
	if b <= a:
		print('Yes')
	else:
		print('No')


nt = int(input())
for qz in range(nt):
	n = int(input())
	a = list(map(int, input().split()))
	ans = 'inc'
	i = 0
	flag = 0
	var = -1
	while ans == 'inc' and i < n:
		if a[i] < i:
			ans = 'dec'
			flag = 1
			if a[i - 1] - a[i] <= 1:
				a[i] = a[i - 1] - 1
			break
		i += 1
	while i < n:
		if a[i] < n - i - 1:
			print('No')
			flag = 2
			break
		i += 1
	if flag != 2:
		print('Yes')


t = int(input())

def tc():
	n = int(input())
	a = list(map(int, input().split(' ')))
	pfxnd = -1
	stfxnd = n
	for i in range(len(a)):
		if a[i] < i:
			break
		pfxnd = i
	for j in range(len(a) - 1, -1, -1):
		if a[j] < n - 1 - j:
			break
		stfxnd = j
	if stfxnd <= pfxnd:
		print('YES')
	else:
		print('NO')
for _ in range(t):
	tc()


def can_sharpen(n, arr):
	is_raising = True
	for (i, a) in enumerate(arr):
		if is_raising:
			if i > a:
				is_raising = False
				if a < n - 1 - i or arr[i - 1] < n - 1 - i + 1:
					return False
		elif a < n - 1 - i:
			return False
	return True
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	if can_sharpen(n, arr):
		print('Yes')
	else:
		print('No')


def sharpened(a):
	n = len(a)
	l = 0
	r = n - 1
	for i in range(n):
		if a[i] >= i:
			l = i
			continue
		else:
			break
	for j in range(n - 1, -1, -1):
		if a[j] >= n - j - 1:
			r = j
			continue
		else:
			break
	if l >= r:
		return 'Yes'
	return 'No'
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(s) for s in input().split(' ')]
	print(sharpened(a))


t = int(input())
for tc in range(t):
	n = int(input())
	ar = list(map(int, input().split()))
	i = 0
	while i < n:
		if ar[i] >= i:
			i += 1
			continue
		else:
			break
	k = i - 1
	if k == n - 1:
		print('Yes')
		continue
	j = n - 1
	while j >= k:
		if ar[j] >= n - j - 1:
			j -= 1
			continue
		else:
			break
	if j != k - 1:
		print('No')
	else:
		print('Yes')


t = int(input())
for o in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	suffix = 0
	prefix = 0
	for i in range(0, n):
		if a[i] < i:
			break
		suffix += 1
	for i in range(n - 1, -1, -1):
		if a[i] < n - i - 1:
			break
		prefix += 1
	if suffix + prefix > n:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	for i in range(n // 2):
		if a[i] < i or a[n - i - 1] < i:
			print('No')
			break
	else:
		if n % 2 == 0:
			x = a[n // 2 - 1]
			y = a[n // 2]
			if x < n // 2 - 1 or y < n // 2 - 1 or x == y == n // 2 - 1:
				print('No')
			else:
				print('Yes')
		elif a[n // 2] < n // 2:
			print('No')
		else:
			print('Yes')


def main():
	T = int(input().strip())
	for _ in range(T):
		n = int(input().strip())
		a = input().strip().split(' ')
		a = [int(x) for x in a]
		tmp = 0
		res1 = True
		for (i, x) in enumerate(a):
			if x < tmp:
				res1 = False
				break
			add = -1
			if i < n // 2:
				add = 1
			elif i == n // 2 and n % 2 == 0:
				add = -2
			tmp += add
		tmp = 0
		res2 = True
		for (i, x) in enumerate(a[::-1]):
			if x < tmp:
				res2 = False
				break
			add = -1
			if i < n // 2:
				add = 1
			elif i == n // 2 and n % 2 == 0:
				add = -2
			tmp += add
		if res1 or res2:
			print('Yes')
		else:
			print('No')
main()


import sys
input = lambda : sys.stdin.readline().rstrip()
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print('Yes')
		continue
	if n == 2:
		if sum(a) == 0:
			print('No')
		else:
			print('Yes')
		continue
	inc = True
	a[0] = 0
	for i in range(n - 1):
		if inc:
			if a[i] == a[i + 1]:
				inc = False
				a[i + 1] -= 1
			elif a[i] < a[i + 1]:
				if i == n - 2 or a[i] + 1 != a[i + 2]:
					a[i + 1] = a[i] + 1
			else:
				inc = False
		elif a[i] <= a[i + 1]:
			a[i + 1] = a[i] - 1
	if a[-1] >= 0:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	n = input()
	num = list(map(int, input().split()))
	chk = 0
	i = 0
	j = len(num) - 1
	check = False
	while True:
		if i > j:
			check = True
			break
		if i + 1 == j:
			if num[i] >= chk and num[j] >= chk + 1 or (num[i] >= chk + 1 and num[j] >= chk):
				check = True
			break
		if num[i] >= chk and num[j] >= chk:
			chk += 1
			i += 1
			j -= 1
			continue
		break
	if check:
		print('Yes')
	else:
		print('No')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print('YES')
	else:
		tmp = 0
		top = n - 1
		for i in range(1, n):
			if tmp < a[i]:
				tmp += 1
			else:
				top = i
				tmp = a[i - 1]
				break
		for i in range(top, n):
			if a[i] < tmp:
				tmp = a[i]
			else:
				tmp = tmp - 1
				if tmp < 0:
					print('NO')
					break
		else:
			print('YES')


from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time

def I():
	return int(input())

def MI():
	return map(int, input().split())

def S():
	return input()

def MS():
	return map(str, input().split())

def LI():
	return [int(i) for i in input().split()]

def LI_():
	return [int(i) - 1 for i in input().split()]

def StoI():
	return [ord(i) - 97 for i in input()]

def ItoS(nn):
	return chr(nn + 97)

def input():
	return sys.stdin.readline().rstrip()

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
YN = {False: 'No', True: 'Yes'}
MOD = 10 ** 9 + 7
inf = float('inf')
IINF = 10 ** 10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
show_flg = False

def solve(T):
	n = I()
	a = LI()
	prefix = -1
	suffix = 10 ** 9
	for k in range(n):
		if a[k] < k:
			break
		prefix = k
	for k in range(n - 1, -1, -1):
		if a[k] < n - k - 1:
			break
		suffix = k
	print(YN[prefix >= suffix])

def main():
	T = I()
	for i in range(T):
		solve(T)
main()


import bisect
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate

def primeFactors(n):
	prime = set()
	while n % 2 == 0:
		prime.add(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			prime.add(i)
			n = n // i
	if n > 2:
		prime.add(n)
	return list(prime)

def getFactors(n):
	factors = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				factors.append(i)
			else:
				factors.append(i)
				factors.append(n // i)
		i = i + 1
	return factors

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	num = []
	for p in range(2, n + 1):
		if prime[p]:
			num.append(p)
	return num

def lcm(a, b):
	return a * b // math.gcd(a, b)

def sort_dict(key_value):
	return sorted(key_value.items(), key=lambda kv: (kv[1], kv[0]))

def list_input():
	return list(map(int, input().split()))

def num_input():
	return map(int, input().split())

def string_list():
	return list(input())

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def binaryToDecimal(n):
	return int(n, 2)

def solve():
	n = int(input())
	a = list_input()
	(i, j) = (0, n - 1)
	while i < n and a[i] >= i:
		i += 1
	while j > -1 and a[j] >= n - 1 - j:
		j -= 1
	if i > j + 1:
		print('Yes')
	else:
		print('No')
t = int(input())
for _ in range(t):
	solve()


import sys
input = sys.stdin.readline
t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	flag = 0
	for i in range(n):
		if a[i] < min(i, n - i - 1):
			flag = 1
			break
	if n % 2 == 0 and a[n // 2] == a[n // 2 - 1] == n // 2 - 1:
		flag = 1
	if flag == 1:
		print('No')
	else:
		print('Yes')


def do_nach(a, n):
	k = -1
	for i in range(n):
		if a[i] >= i:
			pass
		else:
			k = i - 1
			break
	return k

def is_ok(a, k, n):
	if n - k - 2 >= a[k]:
		return False
	zn = n - k - 2
	for i in range(k + 1, n):
		if a[i] >= zn:
			pass
		else:
			return False
		zn -= 1
	return True
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	k = do_nach(a, n)
	if k == -1 or is_ok(a, k, n):
		print('Yes')
	else:
		print('No')


from collections import deque
from math import ceil, floor, sqrt, gcd

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def si():
	return input()
t = 1
t = ii()
while t:
	t -= 1
	n = ii()
	a = li()
	if n == 1:
		print('Yes')
		continue
	if n == 2:
		if a[1] > a[0] or a[1] < a[0]:
			print('Yes')
		elif a[1] > 0:
			print('Yes')
		else:
			print('No')
		continue
	f1 = 0
	f = 0
	a[0] = 0
	a1 = a[:]
	for i in range(1, n):
		if a[i] <= a[i - 1]:
			f = i
			break
		else:
			a[i] = a[i - 1] + 1
	if f:
		a[f - 1] = max(a[f - 1], a1[f - 1])
		for j in range(f, n):
			if a[j] >= a[j - 1]:
				a[j] = a[j - 1] - 1
				if a[j] < 0:
					f1 = 1
					break
		if f1:
			print('No')
		else:
			print('Yes')
	else:
		print('Yes')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print('Yes')
	else:
		s = -1
		e = n
		for i in range(n):
			if a[i] < i:
				break
			else:
				s += 1
		for i in range(n - 1, -1, -1):
			if a[i] < n - i - 1:
				break
			else:
				e -= 1
		if e <= s:
			print('Yes')
		else:
			print('No')


t = int(input())
for i in range(t):
	n = int(input())
	nums = list(map(int, input().split()))
	prefixEnd = -1
	suffixEnd = n
	for i in range(n):
		if nums[i] < i:
			break
		prefixEnd = i
	for i in range(n - 1, -1, -1):
		if nums[i] < n - 1 - i:
			break
		suffixEnd = i
	if suffixEnd <= prefixEnd:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	ans = True
	ch = 0
	f = 1
	s = list(map(int, input().split()))
	p = s * 1
	s[0] = 0
	for i in range(1, len(s)):
		if ch == 0:
			if s[i] >= f:
				s[i] = f
				f += 1
			else:
				s[i - 1] = p[i - 1]
				ch = 1
				f = s[i - 1] - 1
		if ch == 1:
			if f < 0:
				ans = False
				break
			elif s[i] >= f:
				s[i] = f
				f -= 1
			else:
				f = s[i] - 1
	f = p[0] - 1
	help = 0
	for i in range(1, len(p)):
		if f < 0:
			help = -1
			break
		elif p[i] >= f:
			p[i] = f
			f -= 1
		else:
			f = p[i] - 1
	if not ans:
		if help == 0:
			ans = True
	if ans:
		print('Yes')
	else:
		print('No')


T = int(input())
answer = ''
for t in range(T):
	n = int(input())
	arr = list(map(int, input().split(' ')))
	end = False
	can = 0
	if n == 1:
		answer += 'Yes\n'
		continue
	for i in range(n - 1, -1, -1):
		if arr[i] >= n - i - 1:
			can += 1
		else:
			break
	l = -1
	r = n
	for i in range(n):
		if i > 0:
			if arr[i - 1] < i - 1:
				answer += 'No\n'
				end = True
				break
		r -= 1
		l += 1
		if l <= arr[i] and r <= arr[i] and (r <= can):
			answer += 'Yes\n'
			end = True
			break
	if not end:
		answer += 'No\n'
print(answer)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	prefix = -1
	sufix = n
	for i in range(n):
		if a[i] < i:
			break
		prefix = i
	for i in range(n - 1, -1, -1):
		if a[i] < n - 1 - i:
			break
		sufix = i
	if sufix <= prefix:
		print('YES')
	else:
		print('NO')


while True:
	try:
		n = int(input())
		for i in range(n):
			Y = True
			x = int(input())
			y = input().split()
			for j in range(len(y)):
				y[j] = int(y[j])
			if x % 2 == 0:
				if y[x // 2] == y[x // 2 - 1] == x / 2 - 1:
					Y = False
				else:
					for k in range(x // 2):
						if y[k] < k:
							Y = False
							break
						if y[x - k - 1] < k:
							Y = False
							break
			else:
				for k in range((x + 1) // 2):
					if y[k] < k:
						Y = False
						break
					if y[x - k - 1] < k:
						Y = False
						break
			if Y:
				print('Yes')
			else:
				print('No')
	except EOFError:
		break


for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	ty = 'p'
	for i in range(n):
		if ar[i] < i and ty == 'p':
			ty = 'n'
		if ty == 'n':
			if ar[i] >= ar[i - 1]:
				ar[i] = ar[i - 1] - 1
	if ar[-1] < 0:
		print('No')
	else:
		print('Yes')


from sys import stdin

def input():
	return stdin.readline().strip()

def solve(n):
	for i in range(n // 2):
		if a[i] < i or a[n - 1 - i] < i:
			return 'No'
	if n % 2 == 0 and (a[n // 2] >= n // 2 or a[n // 2 - 1] >= n // 2):
		return 'Yes'
	elif n % 2 == 1 and a[n // 2] >= n // 2:
		return 'Yes'
	else:
		return 'No'
for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	print(solve(n))


T = int(input())
for t in range(T):
	n = int(input())
	L = list(map(int, input().split()))
	lr = []
	for x in range(len(L)):
		l = 0
		r = 0
		if L[x] >= n - x - 1:
			r = 1
		if L[x] >= x:
			l = 1
		lr.append((l, r))
	lmax = 0
	rmin = n - 1
	index = 0
	while index < n:
		if lr[index][0]:
			index += 1
		else:
			index -= 1
			break
	lmax = index
	index = n - 1
	while index >= 0:
		if lr[index][1]:
			index -= 1
		else:
			index += 1
			break
	rmin = index
	if lmax >= rmin:
		print('Yes')
	else:
		print('No')


t = int(input())
for iii in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	i = 0
	while i < n and a[i] >= i:
		i += 1
	flag = True
	while i < n:
		if a[i - 1] <= a[i]:
			a[i] = a[i - 1] - 1
		if a[i] < 0:
			print('No')
			flag = False
			break
		i += 1
	if flag:
		print('Yes')


for _ in range(int(input())):
	n = int(input())
	li = list(map(int, input().split()))
	if n == 1:
		print('Yes')
	else:
		(inc, dec) = (-1, n)
		for i in range(n):
			if li[i] < i:
				break
			inc = i
		for i in range(n - 1, -1, -1):
			if li[i] < n - 1 - i:
				break
			dec = i
		print('Yes') if dec <= inc else print('No')


import io
import os
from collections import Counter, defaultdict, deque

def solve(N, A):
	m = N // 2
	if N % 2 == 0:
		best1 = list(range(m + 1)) + list(range(m - 1))[::-1]
		best2 = best1[::-1]
		bests = [best1, best2]
	else:
		best = list(range(m + 1)) + list(range(m))[::-1]
		bests = [best]
	for best in bests:
		assert len(best) == len(A)
		if all((x >= y for (x, y) in zip(A, best))):
			return 'Yes'
	return 'No'
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
T = int(input())
for t in range(T):
	(N,) = [int(x) for x in input().split()]
	A = [int(x) for x in input().split()]
	ans = solve(N, A)
	print(ans)


import sys, collections
tc = int(sys.stdin.readline())
for _ in range(tc):
	n = int(sys.stdin.readline())
	arr = list(map(int, sys.stdin.readline().split()))
	pre = -1
	suf = n
	for i in range(n):
		if arr[i] < i:
			break
		pre = i
	for i in range(n - 1, -1, -1):
		if arr[i] < n - 1 - i:
			break
		suf = i
	print('YES' if pre >= suf else 'NO')


for _ in range(int(input())):
	N = int(input())
	A = list(map(int, input().split(' ')))
	if N == 1:
		print('Yes')
	elif N == 2:
		if A[0] == A[1] == 0:
			print('No')
		else:
			print('Yes')
	else:
		D = A.copy()
		flag = 0
		c = 0
		index = 0
		for i in range(N):
			y = A[i] - c
			if y >= 0:
				A[i] = c
			else:
				index = i
				break
			c += 1
		if index != 0:
			d = 0
			for i in range(N - 1, i - 1, -1):
				y = A[i] - d
				if y >= 0:
					A[i] = d
				else:
					flag = 1
					break
				d += 1
		if A[index] == A[index - 1]:
			if D[index] <= A[index] and D[index - 1] <= A[index - 1]:
				flag = 1
		print('Yes') if flag == 0 else print('No')


T = int(input())
for _ in range(T):
	n = int(input())
	A = [int(x) for x in input().split()]
	B = []
	C = []
	for i in range(n):
		if A[i] >= i:
			B.append(1)
		else:
			B.append(0)
		if A[i] >= n - i - 1:
			C.append(1)
		else:
			C.append(0)
	firstdiffb = -1
	firstdiffc = -1
	for i in range(n - 1):
		if B[i + 1] != B[i]:
			firstdiffb = i + 1
			break
	for i in range(n - 1, 0, -1):
		if C[i] != C[i - 1]:
			firstdiffc = i
			break
	if firstdiffb == -1:
		if B[0] == 1:
			print('Yes')
		else:
			print('No')
	elif firstdiffc == -1:
		if C[-1] == 1:
			print('Yes')
		else:
			print('No')
	elif B[0] == 0:
		print('No')
	elif C[-1] == 0:
		print('No')
	elif firstdiffb > firstdiffc:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	l = 0
	while l < n and a[l] >= l:
		l += 1
	r = n
	while r > 0 and a[r - 1] >= n - r:
		r -= 1
	print(l > r and 'Yes' or 'No')


import os
from io import BytesIO, IOBase
import sys
from collections import defaultdict, deque, Counter
from bisect import *
from math import sqrt, pi, ceil, log, inf, gcd
from itertools import permutations
from copy import deepcopy
from heapq import *
from sys import setrecursionlimit

def solve():
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		return 'Yes'
	else:
		dp = [1] * n
		for i in range(n - 2, -1, -1):
			if a[i] < n - i - 1:
				dp[i] = 0
			dp[i] = dp[i] & dp[i + 1]
		for i in range(n - 1):
			if a[i] < i:
				return 'No'
			if dp[i + 1] and (not (n % 2 == 0 and i == n // 2 - 1 and (a[i] == a[i + 1] == i))):
				return 'Yes'
		return 'No'

def main():
	for _ in range(int(input())):
		print(solve())
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	inc = 0
	while inc < n and a[inc] >= inc:
		inc += 1
	dec = inc - 1
	while dec < n and a[dec] >= n - dec - 1:
		dec += 1
	if inc == n or dec == n:
		print('YES')
	else:
		print('NO')


import sys
t = int(sys.stdin.readline().rstrip())
for _ in range(t):
	n = int(sys.stdin.readline().rstrip())
	s = list(map(int, sys.stdin.readline().rstrip().split(' ')))
	cress = True
	prev = -1
	counter = 0
	for num in s:
		counter += 1
		if cress and num > prev:
			prev = num
		elif cress and num < prev:
			if num >= counter - 1:
				prev = num
			else:
				cress = False
				prev = num
		elif cress and num == prev:
			if num >= counter - 1:
				prev = num
			else:
				cress = False
				prev = num - 1
		elif not cress:
			if num == prev:
				prev = num - 1
			else:
				prev = num
		if not cress:
			if n - counter > prev:
				print('No')
				break
	else:
		print('Yes')


import sys

def sharpen(s, n):
	i = min([n] + [i for i in range(n) if s[i] < i])
	j = max([-1] + [i for i in range(n) if s[i] < n - 1 - i])
	if i == n or j == -1:
		return 'Yes'
	if i - 1 < j + 1:
		return 'No'
	else:
		return 'Yes'
for _ in range(int(input())):
	n = int(sys.stdin.readline().split()[0])
	s = list(map(int, sys.stdin.readline().split()))
	print(sharpen(s, n))


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().strip().split()))
	if n == 1:
		print('YES')
	elif n % 2 == 1:
		flg = 0
		mid = n // 2
		for i in range(0, mid + 1):
			if arr[i] < i:
				flg = 1
				break
		j = 0
		for i in range(n - 1, mid, -1):
			if arr[i] < j:
				flg = 1
				break
			j += 1
		if flg == 0:
			print('YES')
		else:
			print('NO')
	else:
		flg = 0
		mid = n // 2 - 1
		for i in range(mid):
			if arr[i] < i:
				flg = 1
				break
		x = arr[mid]
		y = arr[mid + 1]
		j = 0
		for i in range(n - 1, mid + 1, -1):
			if arr[i] < j:
				flg = 1
				break
			j += 1
		if x >= n // 2 - 1 and y >= n // 2 - 1:
			if x == n // 2 - 1 or y == n // 2 - 1:
				if x == y:
					flg = 1
		else:
			flg = 1
		if flg == 0:
			print('YES')
		else:
			print('NO')


T = n = 0

def get_mark(a):
	mark = []
	for i in range(n):
		if a[i] >= i:
			if i > 0 and (not mark[i - 1]):
				mark.append(False)
			else:
				mark.append(True)
		else:
			mark.append(False)
	return mark

def judge(a):
	mark1 = get_mark(a)
	a.reverse()
	mark2 = get_mark(a)
	mark2.reverse()
	for i in range(n):
		mark1[i] = mark1[i] and mark2[i]
	tmp = [x for x in mark1 if x]
	if tmp:
		return True
	else:
		return False
T = int(input())
while T > 0:
	a = []
	n = int(input())
	a = list(map(int, input().split()))
	if judge(a):
		print('Yes')
	else:
		print('No')
	T -= 1


import atexit
import io
import sys
_IB = sys.stdin.read().splitlines()
input = iter(_IB).__next__
_OB = io.StringIO()
sys.stdout = _OB

@atexit.register
def write():
	sys.__stdout__.write(_OB.getvalue())

class inp:

	@staticmethod
	def int():
		return int(input())

	@staticmethod
	def ilist():
		return list(map(int, input().split()))

	@staticmethod
	def list():
		return input().split()

	@staticmethod
	def itup():
		return map(int, input().split())

	@staticmethod
	def str():
		return list(input())

def main():
	t = inp.int()
	for _ in range(t):
		n = inp.int()
		a = inp.ilist()
		up = True
		for (i, ai) in enumerate(a):
			if up:
				if ai >= i:
					continue
				else:
					break
		else:
			print('Yes')
			continue
		if i != 1:
			a = a[n - 1:i - 2:-1]
		else:
			a = a[n - 1::-1]
		up = True
		for (i, ai) in enumerate(a):
			if up:
				if ai >= i:
					continue
				else:
					print('No')
					break
		else:
			print('Yes')
			continue
main()


from sys import stdin
x = [x.rstrip() for x in stdin]
del x[0]
for i in x[1::2]:
	new = list(map(int, i.split(' ')))
	if len(new) <= 1:
		print('Yes')
	else:
		c = 0
		while c < len(new) and new[c] >= c:
			c += 1
		if c == len(new):
			print('Yes')
		else:
			prev = new[c - 1]
			while c < len(new) and prev != 0:
				if new[c] < prev:
					prev = new[c]
				else:
					prev -= 1
				c += 1
			if c >= len(new):
				print('Yes')
			else:
				print('No')


t = int(input())
while t:
	n = int(input())
	a = input().split()
	for i in range(n):
		a[i] = int(a[i])
	flag = True
	x = 0
	for i in range(n):
		if a[i] - i >= 0 and flag:
			x = a[i]
			a[i] = i
		else:
			if flag:
				a[i - 1] = x
			flag = False
			a[i] = min(a[i - 1] - 1, a[i])
	if a[n - 1] >= 0:
		print('Yes')
	else:
		print('No')
	t -= 1


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ind1 = 0
	ind2 = n
	j = 0
	while ind1 < n and j < n:
		if a[j] >= j:
			j += 1
			ind1 += 1
		else:
			break
	j = n - 1
	while ind2 >= 0 and j >= 0:
		if a[j] >= n - j - 1:
			j -= 1
			ind2 -= 1
		else:
			break
	if ind1 + (n - ind2) >= n + 1:
		print('Yes')
	else:
		print('No')


import os
import sys
from io import BytesIO, IOBase
from math import ceil

def solution(arr):
	n = len(arr)
	(prefix, suffix) = (-1, n - 1)
	for i in range(n):
		if arr[i] < i:
			break
		prefix = i
	for i in range(n - 1, -1, -1):
		if arr[i] < n - i - 1:
			break
		suffix = i
	write('YES' if prefix >= suffix else 'NO')

def main():
	for _ in range(r_int()):
		n = r_array()
		arr = r_array()
		solution(arr)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def write(*args, end='\n'):
	for x in args:
		sys.stdout.write(str(x) + ' ')
	sys.stdout.write(end)

def r_array():
	return [int(x) for x in input().split()]

def r_int():
	return int(input())
main()


from sys import stdin, stdout
from math import gcd, ceil, sqrt
from collections import Counter, deque
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
tc = ii1()
for i in range(tc):
	n = ii1()
	arr = iia()
	arr1 = deque(arr[:])
	cur1 = cur2 = 0
	while len(arr1) and arr1[0] >= cur1:
		arr1.popleft()
		cur1 += 1
	while len(arr1) and arr1[-1] >= cur2:
		arr1.pop()
		cur2 += 1
	if cur1 != cur2 and (not len(arr1)):
		print('Yes')
	else:
		arr1 = deque(arr[:])
		cur1 = cur2 = 0
		while len(arr1) and arr1[-1] >= cur1:
			arr1.pop()
			cur1 += 1
		while len(arr1) and arr1[0] >= cur2:
			arr1.popleft()
			cur2 += 1
		if cur1 != cur2 and (not len(arr1)):
			print('Yes')
		else:
			print('No')


from io import BytesIO, IOBase
from math import sqrt
import sys, os
from os import path
inpl = lambda : list(map(int, input().split()))
inpm = lambda : map(int, input().split())
inpi = lambda : int(input())
inp = lambda : input()
(rev, ra, l) = (reversed, range, len)
P = print
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def B(n):
	return bin(n).replace('0b', '')

def factors(n):
	arr = []
	for i in ra(2, int(sqrt(n)) + 1):
		if n % i == 0:
			arr.append(i)
			if i * i != n:
				arr.append(int(n / i))
	return arr

def prime_factors(n):
	omap = {2: 0}
	while n != 1 and n % 2 == 0:
		omap[2] += 1
		n /= 2
	for i in ra(3, int(math.sqrt(n)) + 1, 2):
		while n != 1 and n % i == 0:
			if i not in omap:
				omap[i] = 1
			else:
				omap[i] += 1
			n /= i
	if n != 1:
		omap[int(n)] = 1
	return omap

def dfs(arr, n):
	pairs = [[i + 1] for i in ra(n)]
	vis = [0] * (n + 1)
	for i in ra(l(arr)):
		pairs[arr[i][0] - 1].append(arr[i][1])
	pairs[arr[i][1] - 1].append(arr[i][0])
	comp = []
	for i in ra(n):
		stack = [pairs[i]]
		temp = []
		if vis[stack[-1][0]] == 0:
			while len(stack) > 0:
				if vis[stack[-1][0]] == 0:
					temp.append(stack[-1][0])
					vis[stack[-1][0]] = 1
					s = stack.pop()
					for j in s[1:]:
						if vis[j] == 0:
							stack.append(pairs[j - 1])
				else:
					stack.pop()
			comp.append(temp)
	return comp
from bisect import bisect_left as bl
from bisect import bisect_right as br
import sys, operator, math, operator
from collections import Counter
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
import random
tc = inpi()
while tc:
	tc -= 1
	n = inpi()
	li = inpl()
	if n == 1:
		P('YES')
	else:
		i = 0
		while i < n and li[i] >= i:
			i += 1
		if i == n:
			P('YES')
		else:
			ma = li[i - 1]
			j = n - 1
			c = 0
			while j >= i and c < ma and (li[j] >= c):
				c += 1
				j -= 1
			if i - 1 == j:
				P('YES')
			else:
				P('NO')


def solve(a):
	n = len(a)
	if n % 2 == 1:
		for i in range(n // 2):
			if a[i] < i:
				return 'No'
		for i in range(n // 2, n):
			if a[i] < n - i - 1:
				return 'No'
		return 'Yes'
	else:
		ans = 'Yes'
		for i in range(n // 2 + 1):
			if a[i] < i:
				ans = 'No'
		for i in range(n // 2 + 1, n):
			if a[i] < n - i - 1:
				ans = 'No'
		if ans == 'Yes':
			return 'Yes'
		for i in range(n // 2 - 1):
			if a[i] < i:
				return 'No'
		for i in range(n // 2 - 1, n):
			if a[i] < n - i - 1:
				return 'No'
		return 'Yes'
t = int(input())
for i in range(t):
	_ = input()
	a = list(map(int, input().split(' ')))
	print(solve(a))


for _ in range(int(input())):
	n = int(input())
	l = [*map(int, input().split())]
	i = 0
	prev = -1
	while i < n:
		if l[i] - i >= 0:
			prev = l[i]
			l[i] = i
			i += 1
		else:
			break
	if i == n:
		print('Yes')
		continue
	if prev != -1 and i < n:
		l[i - 1] = prev
	while i < n:
		if l[i - 1] > l[i]:
			i += 1
		elif l[i - 1] <= l[i]:
			l[i] = l[i - 1] - 1
			if l[i] < 0:
				break
			i += 1
		else:
			break
	if i >= n:
		print('Yes')
	else:
		print('No')


t = int(input())
for q in range(0, t):
	n = int(input())
	a = list(map(int, input().split()))
	lp = 0
	rp = n - 1
	while lp < n and a[lp] >= lp:
		lp += 1
	while rp > -1 and a[rp] >= n - 1 - rp:
		rp -= 1
	lp -= 1
	rp += 1
	if lp >= rp:
		print('Yes')
	else:
		print('No')


t = int(input())
for you in range(t):
	n = int(input())
	l = input().split()
	li = [int(i) for i in l]
	count = 0
	poss = 1
	for i in range(n):
		if li[i] >= i:
			count += 1
		else:
			for j in range(i, n):
				if li[j] < n - 1 - j:
					poss = 0
					break
			if n - i - 1 >= li[i - 1]:
				poss = 0
			break
	if poss:
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	sa = sorted(a)
	count = 0
	div = n // 2
	for i in range(n):
		if a[i] >= div:
			count += 1
	(inc, dec) = (True, True)
	for i in range(1, n):
		if a[i] <= a[i - 1]:
			inc = False
		if a[i] >= a[i - 1]:
			dec = False
	if count == n or inc or dec:
		print('Yes')
	elif n % 2 != 0:
		cond = True
		mid = n // 2
		for i in range(mid + 1):
			if a[i] < i:
				cond = False
			if a[-(i + 1)] < i:
				cond = False
		if cond:
			print('Yes')
		else:
			print('No')
	else:
		cond = True
		mid = n // 2 - 1
		for i in range(mid + 1):
			if a[i] < i:
				cond = False
			if a[-(i + 1)] < i:
				cond = False
		if a[mid] <= mid and a[mid + 1] <= mid:
			cond = False
		if cond:
			print('Yes')
		else:
			print('No')


import sys
import math
import heapq
import collections

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

def inputlist():
	return list(map(int, input().split()))

def inputstring():
	return [x for x in input()]

def inputstringnum():
	return [ord(x) - ord('a') for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
t = int(input())
for q in range(t):
	n = inputnum()
	a = inputlist()
	ind1 = 0
	ind2 = n - 1
	for i in range(n):
		if a[i] < i:
			break
		ind1 = i
	for i in reversed(range(n)):
		if a[i] < n - 1 - i:
			break
		ind2 = i
	if ind1 < ind2:
		print('No')
	else:
		print('Yes')


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	res = 'No'
	ss = 0
	ff = n - 1
	while ss < n and a[ss] >= ss:
		ss += 1
	while ff >= 0 and a[ff] >= n - ff - 1:
		ff -= 1
	ss -= 1
	ff += 1
	if ff <= ss:
		res = 'Yes'
	print(res)

def main():
	t = int(input())
	while t:
		solve()
		t -= 1
main()


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	asc = 0
	while asc < n and a[asc] >= asc:
		asc += 1
	desc = asc - 1
	while desc < n and a[desc] >= n - desc - 1:
		desc += 1
	if asc == n or desc == n:
		print('Yes')
	else:
		print('No')


import math

def main():
	n = int(input())
	a = list(map(int, input().split()))
	for (i, j) in enumerate(a):
		if j < min(i, n - i - 1):
			print('NO')
			return
	if n % 2 == 0:
		if a[n // 2] == a[n // 2 - 1] and a[n // 2 - 1] == n // 2 - 1:
			print('NO')
			return
	print('YES')
	return
for i in range(int(input())):
	main()


tc = int(input())
for ix in range(0, tc):
	n = int(input())
	arr = [int(x) for x in input().split()]
	ml = -1
	for (i, el) in enumerate(arr):
		if el >= i:
			ml = i
		else:
			break
	if ml >= 0:
		mr = -1
		for (i, el) in reversed(list(enumerate(arr))):
			if el >= n - 1 - i:
				mr = i
			else:
				break
		if ml >= mr:
			print('Yes')
		else:
			print('No')
	else:
		print('No')


for t in range(int(input())):
	n = int(input())
	arr = [int(x) for x in input().split()]
	flag = True
	for i in range(len(arr)):
		if arr[i] < min(i, n - (i + 1)):
			flag = False
			break
	left = int(n / 2) - 1
	right = int(n / 2)
	if flag is False:
		print('No')
	elif n % 2 == 1:
		print('Yes')
	elif arr[left] > left or arr[right] > left:
		print('Yes')
	else:
		print('No')


def sharpeArray(arr):
	if len(arr) == 1:
		return 'Yes'
	left = 0
	right = 0
	for i in range(0, len(arr)):
		if arr[i] >= i:
			left = i
		else:
			break
	val = 0
	for i in range(len(arr) - 1, -1, -1):
		if arr[i] >= val:
			right = i
		else:
			break
		val += 1
	if left >= right:
		return 'Yes'
	else:
		return 'No'
testCases = int(input())
for _ in range(0, testCases):
	n = int(input())
	arr = []
	arr = list(map(int, input().split(' ')))
	print(sharpeArray(arr))


from sys import stdin
input = stdin.readline

def read():
	n = int(input())
	a = list(map(int, input().split()))
	return (n, a)

def solve(n, a):
	i = 0
	while i < n and a[i] - i >= 0:
		i += 1
	i -= 1
	j = n - 1
	while j >= 0 and a[j] - (n - 1 - j) >= 0:
		j -= 1
	j += 1
	return not j > i
for t in range(int(input())):
	result = solve(*read())
	print('Yes' if result else 'No')


from collections import defaultdict
q = int(input())
for _ in range(q):
	input()
	t1 = [int(x) for x in input().split(' ')]
	delim = -1
	for i in range(0, len(t1) - 1):
		nxt = t1[i + 1]
		if nxt > i:
			t1[i] = i
		else:
			delim = i
			break
	if delim == -1:
		print('YES')
	else:
		yes = True
		for j in range(delim + 1, len(t1)):
			prev = t1[j - 1]
			t1[j] = min(t1[j], prev - 1)
			if t1[j] < 0:
				yes = False
				break
		if yes:
			print('YES')
		else:
			print('NO')


import sys
import math
import bisect
import heapq
from bisect import bisect_right
from sys import stdin, stdout

def get_ints_in_variables():
	return map(int, sys.stdin.readline().strip().split())

def get_int():
	return int(sys.stdin.readline())

def get_ints_in_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_list_of_list(n):
	return [list(map(int, sys.stdin.readline().strip().split())) for _ in range(n)]

def get_string():
	return sys.stdin.readline().strip()

def myceil(x, y):
	return (x + y - 1) // y

def Solution(arr, n):
	p = 0
	for i in range(n):
		if arr[i] < i:
			break
		p += 1
	for i in range(n - 1, -1, -1):
		if arr[i] < n - (i + 1):
			break
		p += 1
	if p > n:
		print('YES')
	else:
		print('NO')

def main():
	for _ in range(get_int()):
		n = get_int()
		arr = get_ints_in_list()
		Solution(arr, n)
main()


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	c = 0
	for j in range(int(n / 2)):
		if l[j] < j:
			c = 1
	for j in range(n - int(n / 2)):
		if l[n - j - 1] < j:
			c = 1
	if n % 2 == 0 and l[int(n / 2)] == l[int(n / 2) - 1] == int(n / 2) - 1:
		print('NO')
	elif c == 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	array = list(map(int, input().split()))
	k = -1
	for i in range(n):
		if array[i] < i:
			k = i
			break
	if k == -1:
		print('Yes')
		continue
	flag = True
	for i in range(k - 1, n):
		if array[i] < n - 1 - i:
			print('No')
			flag = False
			break
	if flag:
		print('Yes')


from sys import stdin
input = stdin.readline

def getAns(n, a):
	diff = [0] * n
	diff2 = [0] * n
	for i in range(n // 2 + 1):
		diff[i] = i
		diff2[n - i - 1] = i
	for i in range(n // 2 + 1, n):
		diff[i] = n - i - 1
		diff2[n - i - 1] = n - i - 1
	for i in range(n):
		diff[i] = max(a[i] - diff[i], -1)
		diff2[i] = max(a[i] - diff2[i], -1)
	if -1 not in diff or -1 not in diff2:
		print('Yes')
	else:
		print('No')
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split(' ')))
	getAns(n, a)


for _ in range(int(input())):
	n = int(input())
	s = map(int, input().split())
	s = list(s)
	i = 0
	while i != n:
		if s[i] < i:
			break
		i += 1
	j = n - 1
	while j != -1:
		if s[j] < n - 1 - j:
			break
		j -= 1
	i -= 1
	j += 1
	if i < j:
		print('No')
	else:
		print('Yes')


for m in range(int(input())):
	n = int(input())
	arr = [int(x) for x in input().split()]
	first = 0
	for i in range(n):
		if i > arr[i]:
			break
		first = i
	end = 0
	for t in range(n - 1, -1, -1):
		if n - 1 - t > arr[t]:
			break
		end = t
	if first >= end:
		print('Yes')
	else:
		print('No')


import sys
input = sys.stdin.readline

def getInt():
	return int(input())

def getVars():
	return map(int, input().split())

def getList():
	return list(map(int, input().split()))

def getStr():
	return input().strip()
t = getInt()
for _ in range(t):
	n = getInt()
	a = getList()
	res = 'Yes'
	begin = -1
	for i in range(n):
		if a[i] < i:
			begin = i
			break
	if begin > -1:
		for i in range(begin, n):
			a[i] = min(a[i], a[i - 1] - 1)
			if a[i] < 0:
				res = 'No'
				break
	print(res)


t = int(input())
for y in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	(i, j) = (0, n - 1)
	fi = fj = 1
	while i <= j:
		if i == j - 1 and a[i] == i and (a[j] == n - j - 1):
			fi = fj = 0
		if a[i] >= i and fi:
			i += 1
		else:
			fi = 0
		if a[j] >= n - 1 - j and fj:
			j -= 1
		else:
			fj = 0
		if fi == 0 and fj == 0:
			print('No')
			break
	else:
		print('Yes')


t = int(input())
for j in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	d = 0
	for i in range(n // 2):
		if a[i] < i:
			print('NO')
			d = 1
			break
		if a[-i - 1] < i:
			print('NO')
			d = 1
			break
	if n % 2 == 1 and n != 1 and (d != 1):
		if a[(n - 1) // 2] < n // 2:
			print('NO')
			d = 1
	if n % 2 == 0 and d != 1:
		if a[n // 2 - 1] == a[n // 2] and a[n // 2 - 1] < n // 2:
			print('NO')
			d = 1
	if d != 1:
		print('YES')


for _ in range(int(input())):
	N = int(input())
	L = list(map(int, input().split()))
	FLAG = 0
	if N % 2 == 0:
		n = N // 2 - 1
	else:
		n = N // 2 + 1
	for i in range(n):
		x = L[N - 1 - i] - i
		y = L[i] - i
		if x < 0 or x > L[N - 1 - i] or y < 0 or (y > L[i]):
			FLAG = 1
			break
	if FLAG == 1:
		print('No')
	elif N % 2 == 0:
		if L[N // 2 - 1] >= N // 2 - 1 and L[N // 2] >= N // 2 or (L[N // 2 - 1] >= N // 2 and L[N // 2] >= N // 2 - 1):
			print('Yes')
		else:
			print('No')
	elif L[N // 2] >= N // 2:
		print('Yes')
	else:
		print('No')


n = int(input())
for i in range(n):
	f = int(input())
	s = list(map(int, input().split()))
	fl = 0
	t = f
	for j in range(f):
		if s[j] < j:
			t = j
			break
	for j in range(t, f):
		if s[j] < f - j - 1:
			fl = 1
			break
	if fl == 0:
		if s[f // 2] == f // 2 - 1 and s[f // 2 - 1] == f // 2 - 1 and (f % 2 == 0):
			print('No')
		else:
			print('Yes')
	else:
		print('No')


def solve(L, N):
	first = N
	last = -1
	for i in range(N):
		if L[i] < i:
			first = i
			break
	for i in range(N - 1, -1, -1):
		if L[i] < N - i - 1:
			last = i
			break
	if last >= first:
		print('No')
		return
	for i in range(N):
		if L[i] >= i and L[i] >= N - i - 1 and (i < first) and (i > last):
			print('Yes')
			return
	print('No')
t = int(input())
for cnt in range(t):
	N = int(input())
	L = list(map(int, input().split()))
	solve(L, N)


import math, collections, sys
input = sys.stdin.readline

def fromleft(z, n):
	a = [i for i in z]
	prev = -1
	i = 0
	while i < n:
		if a[i] >= prev + 1:
			a[i] = prev + 1
			prev += 1
		else:
			break
		i += 1
	while i < n:
		if prev == 0:
			break
		if a[i] >= prev - 1:
			a[i] = prev - 1
		prev = a[i]
		i += 1
	return a

def fromright(z, n):
	a = [i for i in z]
	prev = -1
	i = n - 1
	while i > -1:
		if a[i] >= prev + 1:
			a[i] = prev + 1
			prev += 1
		else:
			break
		i -= 1
	while i > -1:
		if prev == 0:
			break
		if a[i] >= prev - 1:
			a[i] = prev - 1
		prev = a[i]
		i -= 1
	return a

def check(z, n):
	i = 1
	while i < n and z[i] > z[i - 1]:
		i += 1
	while i < n and z[i] < z[i - 1]:
		i += 1
	return i == n
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	z1 = fromleft(a, n)
	z2 = fromright(a, n)
	if check(z1, n) or check(z2, n):
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	l = 0
	for i in range(n):
		if arr[i] < i:
			break
		l = i
	r = 0
	for i in range(n):
		if arr[n - i - 1] < i:
			break
		r = i
	if l + 1 == n or r + 1 == n or l + r + 1 >= n:
		print('YES')
	else:
		print('NO')


def solve(n, ar):
	prefix = -1
	suffix = n
	for i in range(n):
		if ar[i] < i:
			break
		prefix = i
	for i in range(n - 1, -1, -1):
		if ar[i] < n - 1 - i:
			break
		suffix = i
	if suffix <= prefix:
		print('YES')
	else:
		print('NO')
t = int(input())
for _ in range(t):
	n = int(input())
	ar = list(map(int, input().split()))
	solve(n, ar)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	left = [1] + [0] * (n - 1)
	right = [0] * (n - 1) + [1]
	for i in range(1, n):
		if a[i] >= i:
			left[i] |= left[i - 1]
	for i in range(n - 2, -1, -1):
		if a[i] >= n - i - 1:
			right[i] |= right[i + 1]
	for k in range(n):
		if a[k] >= max(k, n - k - 1) and (left[k - 1] if k > 0 else 1) and (right[k + 1] if k < n - 1 else 1):
			print('Yes')
			break
	else:
		print('No')


def main():
	t = int(input().strip())
	for _ in range(t):
		n = int(input().strip())
		A = [int(s) for s in input().strip().split()]
		if n % 2 == 1:
			result = all((a >= min(i, n - 1 - i) for (i, a) in enumerate(A)))
		else:
			B1 = list(range(n // 2 + 1)) + list(range(n // 2 - 2, -1, -1))
			B2 = B1[::-1]
			result = all((a >= b for (a, b) in zip(A, B1))) or all((a >= b for (a, b) in zip(A, B2)))
		print('Yes' if result else 'No')
main()


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	flag = n + 1
	for i in range(n):
		if a[i] < i:
			flag = i
			break
	for j in range(n - flag + 1):
		if a[n - 1 - j] < j:
			print('No')
			return
	print('Yes')
t = int(input())
for _ in range(t):
	solve()


t = int(input())
for i in range(t):
	n = int(input())
	if n == 1:
		ar = int(input())
	else:
		ar = list(map(int, input().split()))
	if n == 1:
		print('yes')
	elif n == 0:
		print('NO')
	else:
		left = -1
		for i in range(n):
			if ar[i] >= i:
				left = i
			else:
				break
		right = len(ar)
		val = 0
		for j in range(n - 1, -1, -1):
			if ar[j] >= val:
				val += 1
				right = j
			else:
				break
		if left >= right:
			print('Yes')
		else:
			print('No')


import sys
t = int(input())
g = sys.stdin.readlines()
for j in range(t):
	n = int(g[2 * j])
	a = list(map(int, g[2 * j + 1].split()))
	lf = 0
	rf = n - 1
	f = False
	for i in range(1, n):
		if i - 1 < a[i]:
			lf += 1
		else:
			break
	for i in range(n - 2, -1, -1):
		if n - i - 2 < a[i]:
			rf -= 1
		else:
			break
	if lf == n - 1:
		f = True
	if rf == 0:
		f = True
	if rf <= lf:
		f = True
	if f:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	n = int(input())
	s = list(map(int, input().split()))
	flag = 0
	pre = [0 for i in range(n)]
	su = [0 for i in range(n)]
	for i in range(n):
		if s[i] >= i:
			pre[i] = 1
		if s[i] >= n - (i + 1):
			su[i] = 1
	s1 = 0
	s2 = sum(su)
	for i in range(n):
		s1 += pre[i]
		if s1 + s2 == n + 1:
			flag = 1
			break
		s2 -= su[i]
	if flag:
		print('Yes')
	else:
		print('No')


import math

def main():
	n = int(input())
	lst = list(map(int, input().split()))
	i = 0
	while i < len(lst) and lst[i] >= i:
		i += 1
	if i < len(lst):
		i -= 1
	for k in range(i, len(lst)):
		if lst[k] < len(lst) - k - 1:
			print('No')
			return
	print('Yes')
t = int(input())
for i in range(t):
	main()


import math

def solve():
	n = int(input())
	table = list(map(int, input().split()))
	re = True
	for i in range((n + 1) // 2):
		if table[i] < i or table[n - i - 1] < i:
			re = False
			break
	if re and n % 2 == 0 and (table[(n - 1) // 2] == (n - 1) // 2) and (table[n // 2] == (n - 1) // 2):
		re = False
	if re:
		print('YES')
	else:
		print('NO')

def main():
	T = 1
	T = int(input())
	while T:
		solve()
		T -= 1
main()


from math import gcd
import sys
input = sys.stdin.readline
from collections import defaultdict as dd, deque as dq
t = int(input())
while t:
	n = int(input())
	l = list(map(int, input().split()))
	ld = [True]
	rd = dq([True])
	for i in range(n):
		ld.append(ld[-1] and l[i] >= i)
	for i in range(n - 1, -1, -1):
		rd.appendleft(rd[0] and l[i] >= len(rd) - 1)
	lol = 0
	ld.pop(0)
	rd.pop()
	for i in range(n):
		if ld[i] and rd[i]:
			lol = 1
	if lol:
		print('Yes')
	else:
		print('No')
	t -= 1


t = int(input())
answers = []
for ti in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	inc = 0
	for i in range(n):
		if arr[i] < i:
			break
		if arr[i] >= i:
			inc += 1
	decr = 0
	for i in range(n):
		if arr[n - i - 1] >= i:
			decr += 1
		else:
			break
	if inc + decr > n:
		answers.append('YES')
	else:
		answers.append('NO')
for a in answers:
	print(a)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	r = list(reversed(l))
	for i in range(n):
		if l[i] < i:
			temp = i
			break
	else:
		print('Yes')
		continue
	for j in range(n - temp + 1):
		if r[j] < j:
			print('No')
			break
	else:
		print('Yes')


t = int(input())
for query in range(t):
	r = int(input())
	f = [int(x) for x in input().split()]
	pos = True
	for i in range(r // 2):
		if f[i] < i:
			pos = False
		if f[r - i - 1] < i:
			pos = False
	if r % 2 == 0:
		if max(f[r // 2], f[r // 2 - 1]) < r // 2:
			pos = False
	elif f[r // 2] < r // 2:
		pos = False
	if pos == True:
		print('YES')
	else:
		print('NO')


def solve(a):
	i = 0
	while i < len(a) // 2:
		if a[i] < i or a[-(i + 1)] < i:
			return False
		i += 1
	assert i == len(a) // 2
	if len(a) & 1:
		return a[i] >= i
	else:
		return a[i - 1] > i - 1 or a[-i] > i - 1
for T in range(int(input())):
	int(input())
	print('YES' if solve(list(map(int, input().split()))) else 'NO')


import copy
import sys
from collections import defaultdict, Counter

def input():
	return sys.stdin.readline()

def mapi():
	return map(int, input().split())

def maps():
	return map(str, input().split())

def print(arg, *argv, end=None):
	sys.stdout.write(str(arg))
	for i in argv:
		sys.stdout.write(' ' + str(i))
	sys.stdout.write(end) if end else sys.stdout.write('\n')

def GCD(x, y):
	return GCD(y, x % y) if y else x

def modPow(x, y, p):
	(res, x) = (1, x % p)
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		(y, x) = (y >> 1, x * x % p)
	return res

def modInv(s, mod):
	return modPow(s, mod - 2, mod)

def solve():
	t = 1
	t = int(input())
	while t:
		t -= 1
		n = int(input())
		a = list(mapi())
		pf = [True]
		sf = [True]
		for i in range(n):
			pf.append(pf[-1] and a[i] >= i)
			sf.append(sf[-1] and a[n - i - 1] >= i)
		pf = pf[1:]
		sf = sf[::-1]
		sf.pop()
		i = 0
		while i < n:
			if pf[i] and sf[i]:
				break
			i += 1
		if i >= n:
			print('No')
		else:
			print('Yes')
solve()


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().strip().split()))
	left = [0 for _ in range(len(a))]
	right = [0 for _ in range(len(a))]
	for i in range(len(a)):
		if a[i] >= i:
			left[i] = 1
		else:
			break
	for i in range(len(a) - 1, -1, -1):
		if a[i] >= len(a) - i - 1:
			right[i] = 1
		else:
			break
	good = False
	for i in range(len(a)):
		if left[i] == right[i] and left[i] == 1:
			print('Yes')
			good = True
			break
	if not good:
		print('No')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(l, r) = (0, n - 1)
	for i in range(n):
		if a[i] < i:
			l = i - 1
			break
	else:
		print('YES')
		continue
	for i in range(n - 1, -1, -1):
		if a[i] < n - 1 - i:
			r = i + 1
			break
	else:
		print('YES')
		continue
	if r <= l:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	p = -1
	f = 0
	for i in range(n):
		if l[i] < i:
			p = i
			break
	if p > 0:
		for j in range(p - 1, n):
			if l[j] < n - 1 - j:
				f = 1
				break
	if f == 1:
		print('No')
	else:
		print('Yes')


t = int(input())
for i2 in range(t):
	n = int(input())
	x = list(map(int, input().split()))
	(a1, a2, skip) = (0, n - 1, 0)
	for i in range(n):
		if x[i] < i:
			a1 = i - 1
			break
		if i == n - 1:
			skip = 1
	for i in range(n - 1, -1, -1):
		if x[i] < n - i - 1:
			a2 = i + 1
			break
		if i == 0:
			skip = 1
	if skip == 1:
		print('YES')
		continue
	if a2 == a1 + 1:
		if x[a1] > a1 or x[a2] > a1:
			print('YES')
		else:
			print('NO')
	elif a2 <= a1:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
Q = int(input())
Query = []
for _ in range(Q):
	N = int(input())
	A = list(map(int, input().split()))
	Query.append((N, A))
for (N, A) in Query:
	left = -1
	right = -1
	for (i, a) in enumerate(A):
		if a >= i:
			left = i + 1
		else:
			break
	for (i, a) in enumerate(A[::-1]):
		if a >= i:
			right = i + 1
		else:
			break
	print('Yes' if left + right - 1 >= N else 'No')


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
testcases = int(input())
for j in range(testcases):
	n = int(input())
	vals = list(map(int, input().split()))
	up = []
	prefup = 0
	for s in range(n):
		prefup += min(s, vals[s])
		up.append(prefup)
	down = []
	prefdown = 0
	for s in range(n - 1, -1, -1):
		prefdown += min(n - 1 - s, vals[s])
		down.append(prefdown)
	down.reverse()
	found = False
	for s in range(n):
		if s == 0:
			if down[s] >= (n - 1) * n // 2:
				found = True
		elif s == n - 1:
			if up[s] >= (n - 1) * n // 2:
				found = True
		else:
			length1 = s + 1
			length2 = n - s
			if up[s] >= (length1 - 1) * length1 // 2 and down[s] >= (n - 1 - s) * (n - s) // 2:
				found = True
		if found == True:
			break
	if found == False:
		print('No')
	else:
		print('Yes')


ans = []
for _ in range(int(input())):
	n = int(input())
	u = list(map(int, input().split()))
	d = [0] * n
	left = 0
	right = 0
	both = 0
	for i in range(n):
		if u[i] >= i and u[i] >= n - i - 1:
			d[i] = 3
			both += 1
		elif u[i] >= i:
			d[i] = 1
			left += 1
		elif u[i] >= n - i - 1:
			d[i] = 2
			right += 1
	if 0 in d:
		ans.append('No')
		continue
	L = 0
	R = 0
	B = 0
	for i in range(n):
		if d[i] == 1:
			L += 1
		elif d[i] == 2:
			R += 1
		elif L == left and R == 0:
			ans.append('Yes')
			break
	else:
		ans.append('No')
print('\n'.join(ans))


import sys
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = [int(x) for x in input().split()]
	if n != 2:
		i = 1
		t1 = 0
		while i < n:
			if a[i] > t1:
				t1 = t1 + 1
			else:
				break
			i += 1
		i -= 1
		j = n - 2
		t1 = 0
		while j != -1:
			if a[j] > t1:
				t1 = t1 + 1
			else:
				break
			j -= 1
		j += 1
		if j <= i:
			print('YES')
		else:
			print('NO')
	elif a[0] != 0 or a[1] != 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	left = True
	right = True
	end = False
	for (indx, num) in enumerate(arr):
		if left and right:
			if indx - num <= 0:
				left = True
			else:
				left = False
			if indx + num >= len(arr) - 1:
				right = True
			else:
				right = False
			if not left and (not right):
				end = True
				break
		elif left:
			if indx - num <= 0:
				left = True
			else:
				left = False
				end = True
				break
			if indx + num >= len(arr) - 1:
				right = True
			else:
				right = False
		elif right:
			if indx - num <= 0:
				left = True
			else:
				left = False
			if indx + num >= len(arr) - 1:
				right = True
			else:
				right = False
				end = True
				break
	if end:
		print('No')
	else:
		print('Yes')


from sys import stdin, stdout

class Solve:

	def __init__(self):
		R = stdin.readline
		W = stdout.write
		ans = []
		for _ in range(int(input())):
			n = int(input())
			a = [int(x) for x in R().split()]
			r = -1
			for i in range(n):
				if a[i] < i:
					break
				r += 1
			(l, tmp) = (n, 0)
			for i in range(n - 1, -1, -1):
				if a[i] < tmp:
					break
				tmp += 1
				l -= 1
			if l <= r:
				ans.append('Yes')
			else:
				ans.append('No')
		W('\n'.join(ans))

def main():
	s = Solve()
main()


for _ in range(int(input())):
	n = int(input())
	a = [int(o) for o in input().split()]
	a = [-1] + a
	a1 = a[:]
	n += 1
	flag = -1
	for i in range(1, n):
		a1[i] = min(a1[i - 1] + 1, a1[i])
		if a1[i] <= a1[i - 1]:
			a1[i - 1] = a[i - 1]
			flag = i
			break
	if flag != -1:
		for i in range(flag, n):
			a1[i] = min(a1[i - 1] - 1, a1[i])
	if flag == -1:
		print('Yes')
	else:
		flag1 = 0
		for i in range(flag, n):
			if a1[i] < 0:
				flag1 = 1
		if flag1 == 0:
			print('Yes')
		else:
			print('No')


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	N = int(input())
	a = list(map(int, input().split()))
	if a == [0, 0]:
		print('No')
		continue
	tl = [0] * N
	tr = [0] * N
	l = N // 2 - 1 + N % 2
	for i in range(N):
		tl[i] = N - abs(i - l)
	mnl = min(tl)
	for i in range(N):
		tl[i] -= mnl
	tl[0] = 0
	tl[-1] = 0
	if len(tl) > 1:
		for i in range(N):
			if i + 1 >= N:
				break
			if tl[i + 1] == N - mnl:
				break
			tl[i + 1] = tl[i] + 1
	tr = tl[::-1]
	lok = 1
	rok = 1
	for i in range(N):
		if tl[i] > a[i]:
			lok = 0
		if tr[i] > a[i]:
			rok = 0
	if lok or rok:
		print('Yes')
	else:
		print('No')


def can_be_sharpened(array):
	upper = -1
	lower = -1
	size = len(array)
	if size == 1:
		return 'Yes'
	for i in range(size):
		if upper == -1 and i > array[i]:
			upper = i - 1
	for i in range(size - 1, -1, -1):
		val = size - 1 - i
		if lower == -1 and val > array[i]:
			lower = i + 1
	if lower == -1 or upper == -1:
		return 'Yes'
	if upper < lower:
		return 'No'
	return 'Yes'
ans = []
n = int(input())
for i in range(n):
	_ = input()
	array = list(map(int, input().split()))
	ans.append(can_be_sharpened(array))
for i in range(n):
	print(ans[i])


import sys

def sol():
	N = int(sys.stdin.readline())
	A = list(map(int, sys.stdin.readline().split()))
	(inc_flags, dec_flags) = make_tables(N, A)
	for i in range(N):
		if inc_flags[i] is True and dec_flags[i] is True:
			return True
	return False

def make_tables(N, A):
	inc_flags = [False for _ in range(N)]
	dec_flags = [False for _ in range(N)]
	for i in range(N):
		if A[i] < i:
			break
		else:
			inc_flags[i] = True
	for i in range(N - 1, -1, -1):
		if A[i] < N - 1 - i:
			break
		else:
			dec_flags[i] = True
	return (inc_flags, dec_flags)
T = int(input())
for _ in range(T):
	if sol():
		print('Yes')
	else:
		print('No')


def builder(n, lst):
	(pref, suf) = (-1, n)
	for i in range(n):
		if lst[i] < i:
			break
		pref = i
	for i in range(n - 1, -1, -1):
		if lst[i] < n - 1 - i:
			break
		suf = i
	return 'Yes' if suf <= pref else 'No'
for _ in range(int(input())):
	m = int(input())
	a = [int(i) for i in input().split()]
	print(builder(m, a))


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	DK_1 = -1
	for i in range(len(arr)):
		if arr[i] < i:
			break
		DK_1 = i
	DK_2 = n
	i = n - 1
	while i >= 0:
		if arr[i] < n - i - 1:
			break
		DK_2 = i
		i -= 1
	if DK_2 <= DK_1:
		print('YES')
	else:
		print('NO')


def iinput():
	return [int(x) for x in input().split()]

def main():
	n = int(input())
	data = iinput()
	if n % 2 == 0:
		middle = n // 2
		if data[middle - 1] == middle - 1 and data[middle] == middle - 1:
			return 'No'
		for i in range(0, middle):
			if data[i] < i:
				return 'No'
		for i in range(middle, n):
			if data[i] < n - i - 1:
				return 'No'
	else:
		middle = n // 2 + 1
		for i in range(0, middle):
			if data[i] < i:
				return 'No'
		for i in range(middle, n):
			if data[i] < n - i - 1:
				return 'No'
	return 'Yes'
for t in range(int(input())):
	print(main())


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	k = -1
	for (i, num) in enumerate(a):
		if num - i < 0:
			k = i
			break
	if k == -1:
		print('YES')
		continue
	b = a[k:][::-1]
	if len(b) > a[k - 1]:
		print('NO')
		continue
	check = True
	for (i, num) in enumerate(b):
		if num - i < 0:
			check = False
			break
	if check:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = input()
	a = list(map(int, input().split()))
	f = True
	f2 = True
	for j in range(len(a)):
		if f2:
			if a[j] < j:
				f2 = False
				if j >= 1 and a[j] == a[j - 1] and (a[j] == len(a) - j - 1):
					f = False
					break
		if not f2 and a[j] < len(a) - j - 1:
			f = False
			break
	print('Yes' if f else 'No')


import math
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.insert(0, 0)
	f = 1
	pos = -1
	g = 0
	for i in range(1, n + 1):
		if a[i] < i - 1:
			pos = i
			g = 1
			break
	c = 0
	if g == 1:
		for i in range(n, pos - 2, -1):
			if a[i] < c:
				f = 0
				break
			c += 1
	if f:
		print('YES')
	else:
		print('NO')


t = int(input())
for x in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	arr1 = [0 for i in range(n)]
	val = 0
	for i in range(n):
		arr1[i] = val
		if i == n // 2 and n % 2 == 0:
			val -= 1
		if i >= n // 2:
			val -= 1
		else:
			val += 1
	var1 = True
	for i in range(n):
		if l[i] < arr1[i]:
			var1 = False
			break
	var2 = True
	l = l[::-1]
	for i in range(n):
		if l[i] < arr1[i]:
			var2 = False
			break
	if var1 or var2:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l1 = [0] * n
	l2 = [0] * n
	c = 0
	for i in range(n):
		l1[i] = min(i, n - i - 1)
	if n % 2 == 0:
		if l[n // 2 - 1] > l[n // 2]:
			l1[n // 2 - 1] += 1
		if l[n // 2 - 1] <= l[n // 2]:
			l1[n // 2] += 1
	f = 0
	for i in range(n):
		if l1[i] > l[i]:
			f = 1
			break
	if f == 0:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	k = -1
	c = 0
	for i in range(n):
		if l[i] >= i:
			k += 1
		else:
			break
	if k == -1:
		k = 0
	for i in range(k, n):
		if l[i] < n - i - 1:
			c = 1
			break
	if c == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	ans = 'Yes'
	a = list(map(int, input().split()))
	i = 0
	while i < n and a[i] >= i:
		i += 1
	i -= 1
	j = len(a) - 1
	while j >= 0 and a[j] >= n - 1 - j:
		j -= 1
	j += 1
	if j <= i:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	(pre, suf) = (n - 1, 0)
	for i in range(n):
		if l[i] < i:
			pre = i - 1
			break
	for i in range(n):
		if l[n - 1 - i] < i:
			suf = n - i
			break
	if suf <= pre:
		print('Yes')
	else:
		print('No')


from math import *
import sys
input = sys.stdin.readline
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = [int(x) for x in input().split()]
	flag = 0
	for i in range(n):
		if a[i] == 0 and 0 < i < n - 1:
			flag = 1
			break
	if flag == 1:
		print('No')
		continue
	dp = [[0, 0] for i in range(n + 1)]
	flag = [0, 0]
	dp[0][0] = min(n - 1, a[0])
	dp[0][1] = 0
	for i in range(1, n):
		dp[i][0] = min(dp[i - 1][0] - 1, a[i])
		if dp[i][0] < 0:
			flag[0] = 2
		if dp[i - 1][1] + 1 > a[i] and flag[1] == 0:
			flag[1] = 1
			dp[i - 1][1] = max(dp[i - 1][1], a[i - 1])
			dp[i][1] = min(dp[i - 1][1] - 1, a[i])
			if dp[i][1] < 0:
				flag[1] = 2
		elif dp[i - 1][1] + 1 <= a[i] and flag[1] == 0:
			dp[i][1] = dp[i - 1][1] + 1
		elif flag[1] == 1:
			dp[i][1] = min(dp[i - 1][1] - 1, a[i])
			if dp[i][1] < 0:
				flag[1] = 2
		if flag == [2, 2]:
			break
	if flag == [2, 2]:
		print('No')
	else:
		print('Yes')


def read():
	n = int(input())
	a = list(map(int, input().split()))
	return (n, a)

def solve(n, a):
	i = 0
	while i < n and a[i] - i >= 0:
		i += 1
	i -= 1
	j = n - 1
	while j >= 0 and a[j] - (n - 1 - j) >= 0:
		j -= 1
	j += 1
	return not j > i
for t in range(int(input())):
	result = solve(*read())
	print('Yes' if result else 'No')


for _ in range(int(input())):
	s = int(input())
	arr = list(map(int, input().split()))
	l = s
	r = s
	for i in range(s):
		if i > arr[i] and l == s:
			l = i
	arr.reverse()
	for i in range(s):
		if i > arr[i] and r == s:
			r = i
	if s - l - r >= 0:
		print('No')
	else:
		print('Yes')


from math import *
t = int(input())
while t > 0:
	n = int(input())
	a = []
	a = [int(x) for x in input().split()]
	if n == 1:
		print('Yes')
	elif n == 2:
		if a[0] == a[1] and a[0] == 0:
			print('No')
		else:
			print('Yes')
	elif n == 3:
		if a[1] == 0:
			print('No')
		else:
			print('Yes')
	elif n == 4:
		if a[1] == 0 or a[2] == 0:
			print('No')
		elif a[1] == a[2] and a[1] == 1:
			print('No')
		else:
			print('Yes')
	elif n % 2 == 0:
		flag = 0
		for i in range((n - 1) // 2 + 1):
			if a[i] < i or a[-(i + 1)] < i:
				print('No')
				flag = 1
				break
		if flag == 0:
			if a[(n - 1) // 2] == a[n // 2] and a[n // 2] == (n - 1) // 2:
				print('No')
			elif a[1] == 0 or a[-2] == 0:
				print('No')
			else:
				print('Yes')
	else:
		flag = 0
		for i in range((n - 1) // 2 + 1):
			if a[i] < i or a[-(i + 1)] < i:
				print('No')
				flag = 1
				break
		if flag == 0:
			if a[1] == 0 or a[-2] == 0:
				print('No')
			else:
				print('Yes')
	t -= 1


def one():
	return int(input())

def two():
	return map(int, input.split())

def l():
	return list(map(int, input.split()))

def st():
	return input()
for i in range(one()):
	input()
	a = list(map(int, input().split()))
	pik = len(a)
	for j in range(len(a)):
		if a[j] < j:
			pik = j - 1
			break
	ans = True
	for j in range(pik, len(a)):
		if a[j] < len(a) - 1 - j:
			ans = False
			break
	if ans:
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	(c, d) = (0, 0)
	for i in range(n):
		if a[i] >= i:
			c += 1
		else:
			break
	for i in range(n - 1, -1, -1):
		if a[i] >= n - i - 1:
			d += 1
		else:
			break
	if c + d > n:
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	flag = False
	for i in range((n + 1) // 2):
		if a[i] < i or a[n - 1 - i] < i:
			print('No')
			flag = True
			break
	if not flag:
		if n & 1:
			print('Yes')
		elif a[n // 2 - 1] <= n // 2 - 1 and a[n // 2] <= n // 2 - 1:
			print('No')
		else:
			print('Yes')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	l1 = [False] * n
	l2 = [False] * n
	for i in range(n):
		l1[i] = i <= a[i]
		if i > 0:
			l1[i] = l1[i] and l1[i - 1]
	for i in range(n - 1, -1, -1):
		l2[i] = n - i - 1 <= a[i]
		if i < n - 1:
			l2[i] = l2[i] and l2[i + 1]
	if any((l1[i] and l2[i] for i in range(n))) or l1[-1] or l2[0]:
		print('Yes')
	else:
		print('No')


t = int(input())
for j in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	bul = True
	for i in range(n):
		if a[i] < min(i, n - 1 - i):
			bul = False
			break
	if bul:
		if n % 2 == 0 and a[n // 2 - 1] == n // 2 - 1 and (a[n // 2] == n // 2 - 1):
			print('No')
		else:
			print('Yes')
	else:
		print('No')


cases = int(input())

def operate():
	input()
	arr = [int(a) for a in input().strip().split()]
	yes = True
	neg_start = False
	for (i, v) in enumerate(arr):
		if not v >= i:
			neg_start = True
		if neg_start:
			if not v >= len(arr) - i - 1 or (v == len(arr) - i - 1 and (i != 0 and v == arr[i - 1])):
				print('NO')
				yes = False
				break
	if yes:
		print('YES')
for _ in range(cases):
	operate()


tests = int(input())
for te in range(tests):
	n = int(input())
	arr = list(map(int, input().split()))
	l = -1
	for i in range(n):
		if arr[i] >= i:
			l = i
		else:
			break
	r = n - 1
	flag = 0
	for i in range(n - 1, -1, -1):
		if arr[i] >= n - i - 1:
			r = i
			if i == l:
				flag = 1
				break
		else:
			break
	if flag == 1 or n == 1:
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	cnt1 = 0
	cnt2 = 0
	for i in range(n):
		if a[i] >= i:
			cnt1 += 1
		else:
			break
	for i in range(n):
		if a[n - 1 - i] >= i:
			cnt2 += 1
		else:
			break
	if cnt1 + cnt2 > n:
		print('YES')
	else:
		print('NO')


def solve(n, a_s):
	left = [True] * n
	right = [True] * n
	for (i, a) in enumerate(a_s):
		if a < i:
			left[i] = False
		if a < n - 1 - i:
			right[i] = False
	l_max = n - 1
	for (i, l) in enumerate(left):
		if not l:
			l_max = i - 1
			break
	r_max = n - 1
	for (i, r) in enumerate(reversed(right)):
		if not r:
			r_max = i - 1
			break
	if l_max + r_max + 2 < n:
		return 'No'
	if l_max != r_max:
		return 'Yes'
	if l_max + r_max + 2 == n and l_max == r_max and (a_s[l_max] == a_s[n - 1 - r_max]):
		return 'No'
	return 'Yes'
t = int(input())
for _ in range(t):
	n = int(input())
	a_s = [int(ch) for ch in input().split(' ')]
	print(solve(n, a_s))


from __future__ import division, print_function
import math
import os
import sys
from fractions import *
from sys import *
from decimal import *
from io import BytesIO, IOBase
from itertools import *
from collections import *
M = 10 ** 9 + 7
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def fsep():
	return map(float, inp().split())

def inpu():
	return int(inp())

def regularbracket(t):
	p = 0
	for i in t:
		if i == '(':
			p += 1
		else:
			p -= 1
		if p < 0:
			return False
	else:
		if p > 0:
			return False
		else:
			return True

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] <= key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def reverse1(string):
	pp = ''
	for i in string[::-1]:
		pp += i
	if pp == string:
		return True
	return False

def reverse2(list1):
	l = []
	for i in list1[::-1]:
		l.append(i)
	if l == list1:
		return True
	return False

def mex(list1):
	p = max(list1) + 1
	for i in range(len(list1)):
		if list1[i] != i:
			p = i
			break
	return p

def sumofdigits(n):
	n = str(n)
	s1 = 0
	for i in n:
		s1 += int(i)
	return s1

def perfect_square(n):
	s = math.sqrt(n)
	if s == int(s):
		return True
	return False

def roman_number(x):
	if x > 15999:
		return
	value = [5000, 4000, 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]
	symbol = ['F', 'MF', 'M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I']
	roman = ''
	i = 0
	while x > 0:
		div = x // value[i]
		x = x % value[i]
		while div:
			roman += symbol[i]
			div -= 1
		i += 1
	return roman

def soretd(s):
	for i in range(1, len(s)):
		if s[i - 1] > s[i]:
			return False
	return True

def countRhombi(h, w):
	ct = 0
	for i in range(2, h + 1, 2):
		for j in range(2, w + 1, 2):
			ct += (h - i + 1) * (w - j + 1)
	return ct

def countrhombi2(h, w):
	return h * h // 4 * (w * w // 4)

def binpow(a, b):
	if b == 0:
		return 1
	else:
		res = binpow(a, b // 2)
	if b % 2 != 0:
		return res * res * a
	else:
		return res * res

def binpowmodulus(a, b, m):
	a %= m
	res = 1
	while b > 0:
		if b & 1:
			res = res * a % m
		a = a * a % m
		b >>= 1
	return res

def coprime_to_n(n):
	result = n
	i = 2
	while i * i <= n:
		if n % i == 0:
			while n % i == 0:
				n //= i
			result -= result // i
		i += 1
	if n > 1:
		result -= result // n
	return result

def prime(x):
	if x == 1:
		return False
	else:
		for i in range(2, int(math.sqrt(x)) + 1):
			if x % i == 0:
				return False
		else:
			return True

def luckynumwithequalnumberoffourandseven(x, n, a):
	if x >= n and str(x).count('4') == str(x).count('7'):
		a.append(x)
	elif x < 1000000000000.0:
		luckynumwithequalnumberoffourandseven(x * 10 + 4, n, a)
		luckynumwithequalnumberoffourandseven(x * 10 + 7, n, a)
	return a

def luckynum(x, l, r, a):
	if x >= l and x <= r:
		a.append(x)
	if x > r:
		a.append(x)
		return a
	if x < 10000000000.0:
		luckynum(x * 10 + 4, l, r, a)
		luckynum(x * 10 + 7, l, r, a)
	return a

def luckynuber(x, n, a):
	p = set(str(x))
	if len(p) <= 2:
		a.append(x)
	if x < n:
		luckynuber(x + 1, n, a)
	return a

def interact(type, x):
	if type == 'r':
		inp = input()
		return inp.strip()
	else:
		print(x, flush=True)

def findTrailingZeros(n):
	count = 0
	while n >= 5:
		n //= 5
		count += n
	return count

def mergeSort(arr):
	if len(arr) > 1:
		mid = len(arr) // 2
		L = arr[:mid]
		R = arr[mid:]
		mergeSort(L)
		mergeSort(R)
		i = j = k = 0
		while i < len(L) and j < len(R):
			if L[i] < R[j]:
				arr[k] = L[i]
				i += 1
			else:
				arr[k] = R[j]
				j += 1
			k += 1
		while i < len(L):
			arr[k] = L[i]
			i += 1
			k += 1
		while j < len(R):
			arr[k] = R[j]
			j += 1
			k += 1
res = set()

def solven(p, l, a, b, n):
	if p > n or l > 10:
		return
	if p > 0:
		res.add(p)
	solven(p * 10 + a, l + 1, a, b, n)
	solven(p * 10 + b, l + 1, a, b, n)

def subsetsUtil(A, subset, index, d):
	print(*subset)
	s = sum(subset)
	d.append(s)
	for i in range(index, len(A)):
		subset.append(A[i])
		subsetsUtil(A, subset, i + 1, d)
		subset.pop(-1)
	return d

def subsetSums(arr, l, r, d, sum=0):
	if l > r:
		d.append(sum)
		return
	subsetSums(arr, l + 1, r, d, sum + arr[l])
	subsetSums(arr, l + 1, r, d, sum)
	return d

def print_factors(x):
	factors = []
	for i in range(1, x + 1):
		if x % i == 0:
			factors.append(i)
	return factors

def calc(X, d, ans, D):
	if len(X) == 0:
		return
	i = X.index(max(X))
	ans[D[max(X)]] = d
	Y = X[:i]
	Z = X[i + 1:]
	calc(Y, d + 1, ans, D)
	calc(Z, d + 1, ans, D)

def factorization(n, l):
	c = n
	if prime(n) == True:
		l.append(n)
		return l
	for i in range(2, c):
		if n == 1:
			break
		while n % i == 0:
			l.append(i)
			n = n // i
	return l

def good(b):
	l = []
	i = 0
	while len(b) != 0:
		if b[i] < b[len(b) - 1 - i]:
			l.append(b[i])
			b.remove(b[i])
		else:
			l.append(b[len(b) - 1 - i])
			b.remove(b[len(b) - 1 - i])
	if l == sorted(l):
		return True
	return False

def generate(st, s):
	if len(s) == 0:
		return
	if s not in st:
		st.add(s)
		for i in range(len(s)):
			t = list(s).copy()
			t.remove(s[i])
			t = ''.join(t)
			generate(st, t)
	return

def largestincreasingsubsequence(A):
	l = [1] * len(A)
	sub = []
	for i in range(1, len(l)):
		for k in range(i):
			if A[k] < A[i]:
				sub.append(l[k])
		l[i] = 1 + max(sub, default=0)
	return max(l, default=0)

def findOR(nums, N):
	prefix_sum = 0
	result = 0
	for i in range(N):
		result |= nums[i]
		prefix_sum += nums[i]
		result |= prefix_sum
	return result

def OR(a, n):
	ans = a[0]
	for i in range(1, n):
		ans |= a[i]
	return ans

def main():
	for _ in range(inpu()):
		n = inpu()
		arr = lis()
		i = 0
		j = n - 1
		while i < n and arr[i] >= i:
			i += 1
		while j >= 0 and arr[j] >= n - 1 - j:
			j -= 1
		if i > j + 1:
			print('YES')
		else:
			print('NO')
main()


def find(A):
	left = [-1] * len(A)
	right = [-1] * len(A)
	c = 0
	for i in range(len(A)):
		if A[i] >= c:
			left[i] = c
			c += 1
		else:
			break
	c = 0
	for i in range(len(A) - 1, -1, -1):
		if A[i] >= c:
			right[i] = c
			c += 1
		else:
			break
	for i in range(len(li)):
		if left[i] > -1 and right[i] > -1:
			return 'Yes'
	return 'No'
for i in range(int(input())):
	x = int(input())
	li = list(map(int, input().split()))
	print(find(li))


def solve():
	n = int(input())
	arr = list(map(int, input().split()))
	(left, right) = (-1, n)
	for i in range(n):
		if arr[i] >= i and arr[i] >= n - i - 1:
			left = i
		if arr[i] < i:
			break
	for i in range(n - 1, -1, -1):
		if arr[i] >= n - i - 1 and arr[i] >= i:
			right = i
		if arr[i] < n - i - 1:
			break
	return 'Yes' if left >= right else 'No'
for _ in range(int(input())):
	print(solve())


import sys
import math
import itertools
import functools
import collections
import operator

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=2):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)
t = ii()
for _ in range(t):
	n = ii()
	a = li()
	if n == 1:
		print('Yes')
	elif n & 1:
		f = True
		for i in range(n // 2 + 1):
			if a[i] < i:
				f = False
				break
		if f:
			for i in range(n // 2 + 1, n):
				if a[i] < n - i - 1:
					f = False
					break
		if f:
			print('Yes')
		else:
			print('No')
	else:
		f = True
		for i in range(n // 2):
			if a[i] < i:
				f = False
				break
		if f:
			for i in range(n // 2, n):
				if a[i] < n - i - 1:
					f = False
					break
		if a[n // 2] == n // 2 - 1 and a[n // 2 - 1] == n // 2 - 1:
			f = False
		if f:
			print('Yes')
		else:
			print('No')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	i = 1
	while i < n and arr[i] > arr[i - 1]:
		i += 1
	while i < n and arr[i] < arr[i] - 1:
		i -= 1
	if i == n:
		print('YES')
		continue
	i = 1
	for i in range(1, n):
		if arr[i] >= arr[i - 1]:
			break
	if i == n:
		print('YES')
		continue
	(i, j) = (0, n - 1)
	flag = True
	while i < j:
		if arr[i] < i or arr[j] < i:
			flag = False
			break
		i += 1
		j -= 1
	if i < j:
		print('NO')
		continue
	if i == j:
		if arr[i] < i:
			flag = False
	if i > j:
		if arr[i] == arr[j] and arr[i] == j:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	x = int(input())
	s = [int(t) for t in input().split(' ')]
	if x == 1:
		print('Yes')
		continue
	for j in range(x):
		if s[j] < j:
			break
		if j == x - 1:
			j = j + 1
	for k in range(x):
		if s[x - k - 1] < k:
			break
		if k == x - 1:
			k = k + 1
	if j + k > x:
		print('Yes')
	else:
		print('No')


t = int(input())
ans = []

def f(ns):
	ok = True
	for i in range(len(ns)):
		if 0 <= i <= int(ns[i]) or len(ns) - int(ns[i]) - 1 <= i <= len(ns) - 1:
			ok = True
		else:
			ok = False
			break
	if ok:
		if len(ns) % 2 == 0:
			h = len(ns) // 2
			if int(ns[h - 1]) == h - 1 and int(ns[h]) == h - 1:
				return 'No'
			else:
				return 'Yes'
		else:
			return 'Yes'
	else:
		return 'No'
for i in range(t):
	n = int(input())
	s = input()
	ns = s.split()
	ans.append(f(ns))
for e in ans:
	print(e)


def check(n, a):
	for i in range(n // 2):
		if a[i] < i:
			return 0
	j = 0
	for i in range(n - 1, n // 2 - 1, -1):
		if a[i] < j:
			return 0
		j += 1
	if n % 2 == 0:
		if a[n // 2 - 1] == a[n // 2] and a[n // 2] == n // 2 - 1:
			return 0
	return 1
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if check(n, a):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	dp1 = [True] + [False] * (n - 1)
	for i in range(1, n):
		dp1[i] = dp1[i - 1] and a[i] >= i
	dp2 = [False] * (n - 1) + [True]
	for i in range(n - 2, -1, -1):
		dp2[i] = dp2[i + 1] and a[i] >= n - i - 1
	for i in range(n):
		if dp1[i] and dp2[i]:
			print('Yes')
			break
	else:
		print('No')


def gcd(a, b):
	return math.gcd(a, b)

def lcm(a, b):
	return a * b // math.gcd(a, b)

def ncr(n, r):
	return math.comb(n, r)

def npr(n, r):
	return math.factorial(n) // math.factorial(n - r)
import sys, os.path
import math
from collections import defaultdict, deque
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
S = lambda : list(map(str, input1()))

def main():
	(t,) = I()
	for t1 in range(t):
		(n,) = I()
		a = I()
		if n == 1:
			print('Yes')
			continue
		else:
			left = [False] * n
			right = [False] * n
			for i in range(n - 1, -1, -1):
				if a[i] >= n - i - 1:
					right[i] = True
				if i + 1 < n:
					right[i] = right[i + 1] and right[i]
			for i in range(n):
				if a[i] >= i:
					left[i] = True
				if i - 1 >= 0:
					left[i] = left[i - 1] and left[i]
			count = 0
			for i in range(len(left)):
				if left[i] and right[i]:
					print('Yes')
					count = 1
					break
			if count == 0:
				print('No')
main()


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	last = -1
	turned = 0
	before = -1
	for x in a:
		if not turned:
			if last < x:
				last += 1
			else:
				turned = 1
				last = min(before - 1, x)
		else:
			last = min(last - 1, x)
		before = x
	if not turned or last >= 0:
		print('Yes')
	else:
		print('No')


def solve(A):
	a = A[:]
	incr = True
	a[0] = 0
	for i in range(1, len(a)):
		if incr:
			a[i] = min(a[i], a[i - 1] + 1)
			if a[i] <= a[i - 1]:
				incr = False
		if not incr:
			a[i] = max(min(a[i], a[i - 1] - 1), 0)
			if a[i] >= a[i - 1]:
				return False
	return True
t = int(input())
for i in range(t):
	n = input()
	a = list(map(int, input().split()))
	print('Yes' if solve(a) or solve(a[::-1]) else 'No')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	check = []
	for i in range(len(a)):
		if a[i] >= i:
			check.append(True)
		else:
			check.append(False)
	check2 = []
	for i in range(len(a)):
		if a[i] >= n - i - 1:
			check2.append(True)
		else:
			check2.append(False)
	i = -1
	for j in range(n):
		if check[j] != True:
			i = j
			break
	x = 0
	if i == -1:
		print('Yes')
	elif i == 0:
		ll = 0
		for k in check2:
			if k == False:
				ll = 1
		if ll == 1:
			print('No')
		else:
			print('Yes')
	else:
		for k in range(i - 1, n):
			if check2[k] == False:
				x = 1
				break
		if x == 1:
			print('No')
		else:
			print('Yes')


def inp(dtype=str, strip=True):
	s = input()
	res = [dtype(p) for p in s.split()]
	res = res[0] if len(res) == 1 and strip else res
	return res

def problemA():
	t = int(input())
	for _ in range(t):
		n = int(input())
		s = input()
		s = [int(el) for el in s]
		res = '-1'
		cum = sum(s)
		i = 1
		while i <= n:
			if s[-i] % 2 != 0 and cum % 2 == 0:
				res = ''.join([str(s[j]) for j in range(n - i + 1)])
				break
			cum -= s[-i]
			i += 1
		print(res)

def problemB():
	t = int(input())
	for tcase in range(t):
		n = int(input())
		a = inp(int, strip=False)
		next = a[0] + 1 if a[0] <= 0 else 1
		i = 1
		while i < n and a[i] >= next:
			if a[i] < 0:
				next = a[i] + 1
			elif next <= 0:
				next = 1
			else:
				next += 1
			i += 1
		if i == n:
			print('YES')
			continue
		ileft = i - 1
		gapleft = a[ileft] < next - 1
		i = n - 1
		next = a[i] + 1 if a[i] <= 0 else 1
		i -= 1
		while i >= 0 and a[i] >= next:
			if a[i] < 0:
				next = a[i] + 1
			elif next <= 0:
				next = 1
			else:
				next += 1
			i -= 1
		if i < 0:
			print('YES')
			continue
		iright = i + 1
		gapright = a[iright] < next - 1
		if ileft + 1 > iright:
			print('YES')
		elif ileft + 1 == iright:
			if a[ileft] != a[iright]:
				print('YES')
			elif a[ileft] > 0 and (gapleft or gapright):
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
problemB()


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	flag_r = False
	flag_l = False
	r = n - 1
	l = 0
	for i in range(n):
		if flag_r == False and a[i] < i:
			r = i - 1
			flag_r = True
		if flag_l == False and a[n - 1 - i] < i:
			l = n - 1 - i + 1
			flag_l = True
	if l <= r:
		print('Yes')
	else:
		print('No')


import sys
import math
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	maxi = -1
	ind = -1
	for i in range(n):
		if arr[i] < i:
			maxi = arr[i]
			ind = i - 1
			break
	flag = 0
	if ind != -1:
		for i in range(ind):
			if arr[i] < i:
				flag = 1
				break
		for i in range(ind + 1, n):
			if arr[i] < n - i - 1:
				flag = 1
				break
			else:
				arr[i] = n - i - 1
				if arr[i] == arr[ind]:
					flag = 1
					break
	if flag:
		print('No')
	else:
		print('Yes')


for _ in range(int(input())):
	n = int(input())
	arr = [int(x) for x in input().split()]
	left = -1
	for i in range(n):
		if arr[i] >= i:
			left = i
		else:
			break
	if left == n - 1:
		print('Yes')
		continue
	right = -1
	for i in range(n - 1, -1, -1):
		if arr[i] >= n - 1 - i:
			right = i
		else:
			break
	if right <= left:
		print('Yes')
	else:
		print('No')


import sys

class BArraySharpening:

	def solve(self):

		def decide(arr):
			cur = -1
			stop = n
			for i in range(n):
				if arr[i] <= cur:
					stop = i
					break
				else:
					cur += 1
			cur = -1
			if stop == n:
				return True
			for i in range(n - 1, stop - 2, -1):
				if arr[i] <= cur:
					return False
				cur += 1
			return True
		for _ in range(int(input())):
			n = int(input())
			a = [int(_) for _ in input().split()]
			print('Yes' if decide(a) else 'No')
solver = BArraySharpening()
input = sys.stdin.readline
solver.solve()


for _ in range(int(input())):
	n = int(input())
	lis = list(map(int, input().split()))
	k = lis[0]
	lis[0] = 0
	c = n
	for j in range(1, n):
		if lis[j] >= k:
			k -= 1
		else:
			k = lis[j]
	if k >= 0:
		print('Yes')
		continue
	k = lis[0]
	for i in range(1, n):
		if i <= lis[i]:
			k = i
		else:
			if lis[i] == lis[i - 1]:
				k = lis[i] - 1
			else:
				k = lis[i]
			c = i
			break
	for j in range(c + 1, n):
		if lis[j] >= k:
			k -= 1
		else:
			k = lis[j]
	if k < 0:
		print('No')
	else:
		print('Yes')


from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	f = True
	for i in range(n):
		if a[i] >= i:
			continue
		elif a[i] < i and f:
			f = False
			if a[i] == a[i - 1]:
				a[i] -= 1
			if a[i] < n - 1 - i:
				stdout.write('No\n')
				break
		elif not f and a[i] >= n - 1 - i:
			continue
		else:
			stdout.write('No\n')
			break
	else:
		stdout.write('Yes\n')


t = int(input())
for case in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	ans = True
	for i in range(n):
		lower_bound = min(i, n - 1 - i)
		if arr[i] < lower_bound:
			ans = False
			break
	if n % 2 == 0:
		if max(arr[(n - 1) // 2], arr[n // 2]) <= (n - 1) // 2:
			ans = False
	print('Yes' if ans else 'No')


import sys, math

def input():
	return sys.stdin.readline()[:-1]

def main():
	q = int(input())
	for _ in range(q):
		n = int(input())
		a = list(map(int, input().split()))
		f = -1
		ans = 0
		for k in range(n):
			if a[k] < k:
				f = k
				break
		if f == -1:
			ans = 1
		else:
			a = a[::-1]
			ans = 1
			for k in range(n - f + 1):
				if a[k] < k:
					ans = 0
					break
		if ans == 1:
			print('Yes')
		else:
			print('No')
main()


import sys
input = sys.stdin.readline
t = int(input())
for tests in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	LMAX = [-1] * n
	for i in range(n):
		if A[i] >= i:
			LMAX[i] = A[i]
		else:
			break
	RMAX = [-1] * n
	for i in range(n):
		if A[n - 1 - i] >= i:
			RMAX[n - 1 - i] = A[n - 1 - i]
		else:
			break
	for i in range(n):
		if LMAX[i] != -1 and RMAX[i] != -1:
			print('Yes')
			break
	else:
		print('No')


import sys

def fastio():
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()

def debug(*var, sep=' ', end='\n'):
	print(*var, file=sys.stderr, end=end, sep=sep)
INF = 10 ** 20
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br
(t,) = I()
while t:
	t -= 1
	(n,) = I()
	a = I()
	(i, j) = (0, n - 1)
	ans = 'Yes'
	cur = 0
	while i <= j:
		if a[i] >= cur and a[j] >= cur:
			cur += 1
			i += 1
			j -= 1
		else:
			ans = 'No'
			break
	if n % 2 == 0 and a[j] == a[i] == cur - 1:
		ans = 'No'
	print(ans)


import sys
import math
from collections import defaultdict, Counter
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	flag = 0
	for j in range(n):
		if flag == 0:
			if a[j] >= j:
				continue
			flag = 1
			if a[j] == a[j - 1]:
				a[j] -= 1
			if a[j] < n - j - 1:
				print('No')
				break
		elif a[j] >= n - j - 1:
			continue
		else:
			print('No')
			break
	else:
		print('Yes')


import sys
inp = sys.stdin.readline

def input():
	return inp().strip()
out = []

def iin():
	return int(input())

def lin():
	return list(map(int, input().split()))

def main():
	T = iin()
	while T:
		T -= 1
		n = iin()
		a = lin()
		(c1, c2) = (0, 0)
		for i in range(n):
			if a[i] >= i:
				c1 += 1
			else:
				break
		for i in range(n):
			if a[-i - 1] >= i:
				c2 += 1
			else:
				break
		if c1 + c2 - 1 < n:
			print('NO')
		else:
			print('YES')
main()


import sys
from operator import itemgetter
input = sys.stdin.readline
from collections import defaultdict as dc
from bisect import bisect_left, bisect_right
import math
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	a = -1
	b = n
	for i in range(n):
		if l[i] < i:
			break
		a = i
	for i in range(n - 1, -1, -1):
		if l[i] < n - 1 - i:
			break
		b = i
	if b <= a:
		print('Yes')
	else:
		print('NO')


def solve(lst):
	for i in range(len(lst)):
		if lst[i] < min(i, len(lst) - i - 1):
			return False
	n = len(lst)
	if n % 2 == 0:
		return max(lst[n // 2 - 1], lst[n // 2]) > n // 2 - 1
	return True
m = int(input())
for _ in range(m):
	n = input()
	lst = list(map(int, input().split()))
	if solve(lst):
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	type = 0
	ok = 1
	for i in range(n):
		if a[i] < i:
			type = 1
		if type == 1:
			if a[i] >= a[i - 1]:
				if a[i - 1] == 0:
					ok = 0
					break
				a[i] = a[i - 1] - 1
	if ok == 1:
		print('Yes')
	else:
		print('No')


import sys
import math
import collections
import heapq
input = sys.stdin.readline
t = int(input())
for w in range(t):
	n = int(input())
	l = [int(i) for i in input().split()]
	(c1, c2) = (0, n - 1)
	while c1 < n and l[c1] >= c1:
		c1 += 1
	while c2 >= 0 and l[c2] >= n - 1 - c2:
		c2 -= 1
	if c1 > c2 + 1:
		print('Yes')
	else:
		print('No')


import sys
import math
from collections import defaultdict
from collections import deque
from itertools import combinations
from itertools import permutations
input = lambda : sys.stdin.readline().rstrip()
read = lambda : list(map(int, input().split()))
go = lambda : 1 / 0

def write(*args, sep='\n'):
	for i in args:
		sys.stdout.write('{}{}'.format(i, sep))
INF = float('inf')
MOD = int(1000000000.0 + 7)
YES = 'Yes'
NO = 'No'
for _ in range(int(input())):
	try:
		n = int(input())
		arr = read()
		if n == 1:
			print(YES)
			go()
		if n == 2:
			if sum(arr) == 0:
				print(NO)
				go()
			else:
				print(YES)
				go()
		for i in range(n):
			if arr[i] == 0 and i != 0 and (i != n - 1):
				print(NO)
				go()
		idx = -1
		for i in range(n):
			if arr[i] >= i:
				idx = i
			else:
				break
		cur_min = arr[idx]
		for i in range(idx + 1, n):
			if arr[i] >= cur_min:
				if cur_min == 0:
					print(NO)
					go()
				cur_min = cur_min - 1
			else:
				cur_min = arr[i]
		print(YES)
	except:
		continue


import sys
import math
import bisect

def solve(A):
	n = len(A)
	nl = 0
	nr = 0
	for i in range(n):
		if A[i] >= i:
			nl += 1
		else:
			break
	for i in range(n - 1, -1, -1):
		if A[i] >= n - 1 - i:
			nr += 1
		else:
			break
	if nl + nr - 1 >= n:
		return True
	else:
		return False

def main():
	for _ in range(int(input())):
		n = int(input())
		A = list(map(int, input().split()))
		if solve(A):
			print('Yes')
		else:
			print('No')
main()


t = int(input())
for ti in range(t):
	n = int(input())
	a = input().split()
	themax = 0
	try:
		for i in range(n):
			a[i] = int(a[i])
			if a[i] < i and a[i] < n - i - 1:
				raise Exception
		if n % 2 == 0:
			if a[int(n / 2)] < int(n / 2) and a[int(n / 2) - 1] < int(n / 2):
				raise Exception
		print('Yes')
	except:
		print('No')


import math

def main_function():
	test_cases = range(int(input()))
	for test_case in test_cases:
		n = int(input())
		a = [int(i) for i in input().split(' ')]
		up_mode = True
		is_good = True
		current_level = a[0]
		min_current_level = 0
		for i in range(1, len(a)):
			if up_mode:
				if a[i] > min_current_level:
					current_level = a[i]
					min_current_level += 1
				elif a[i] == min_current_level:
					if min_current_level >= i:
						current_level = a[i]
					else:
						if current_level == min_current_level:
							current_level = min_current_level - 1
						else:
							current_level = min_current_level
						if current_level < 0:
							is_good = False
						up_mode = False
				else:
					current_level = min(a[i], current_level - 1)
					if current_level < 0:
						is_good = False
					up_mode = False
			else:
				current_level = min(a[i], current_level - 1)
				if current_level < 0:
					is_good = False
					break
		if is_good:
			print('Yes')
		else:
			print('No')
main_function()


(K,) = map(int, input().split())
for _ in range(K):
	(N,) = map(int, input().split())
	xs = list(map(int, input().split()))
	ys = [0] * N
	for (i, x) in enumerate(xs):
		if x >= i:
			ys[i] = 1
		else:
			break
	for (j, x) in enumerate(xs[::-1]):
		if x >= j:
			if ys[N - j - 1]:
				print('Yes')
				break
		else:
			print('No')
			break


for i in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	ans = 'Yes'
	flag = 0
	if n == 1 or (n == 2 and x[0] != x[1] != 0):
		ans = 'Yes'
	elif n == 2 and x[0] == x[1] == 0:
		ans = 'No'
	else:
		for j in range(n):
			if x[j] < j:
				flag = 1
				break
		if flag == 1:
			maximum = x[0]
			for j in range(n):
				if x[j] < maximum or maximum < 0:
					flag = 2
					break
				maximum -= 1
		if flag == 2:
			flag2 = 0
			for j in range(n):
				if x[j] - j < 0:
					flag2 = 1
				if flag2 == 1 and x[j - 1] < n - j:
					flag = 3
	if flag == 3:
		ans = 'No'
	print(ans)


import sys
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, sys.stdin.readline().split()))
	ans = 'Yes'
	for i in range(n):
		if l[i] < min(i, n - 1 - i):
			ans = 'No'
		if n % 2 == 0:
			if l[n // 2] == l[n // 2 - 1] == n // 2 - 1:
				ans = 'No'
	print(ans)


from functools import reduce
import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def arr():
	return [int(i) for i in input().split()]

def sarr():
	return [int(i) for i in input()]

def starr():
	return [str(x) for x in input().split()]

def inn():
	return int(input())

def svalue():
	return tuple(map(str, input().split()))

def parr():
	return [value() for i in range(n)]
mo = 1000000007
for _ in range(inn()):
	n = inn()
	a = arr()
	if min(a) >= n:
		print('YES')
		continue
	ans = 'No'
	flag = 0
	for i in range(n):
		if a[i] < i:
			flag = 1
	if flag == 0:
		print('Yes')
		continue
	flag = 0
	for i in range(n):
		if a[i] < n - i - 1:
			flag = 1
	if flag == 0:
		print('Yes')
		continue
	flag = 0
	for i in range(n):
		if a[i] < i and a[i] < n - i - 1:
			flag = 1
	if n % 2 == 0:
		res = n // 2
		if a[res] == a[res - 1] == res - 1:
			flag = 1
	if flag == 0:
		print('Yes')
		continue
	print(ans)


t = int(input())
for j in range(t):
	n = int(input())
	a = input().split(' ')
	start = []
	end = []
	for i in range(len(a)):
		a[i] = int(a[i])
		if a[i] >= i:
			start.append(1)
		else:
			start.append(0)
		if a[i] >= n - 1 - i:
			end.append(1)
		else:
			end.append(0)
	possible = False
	for i in range(len(a) - 1):
		start[i + 1] *= start[i]
		end[n - 2 - i] *= end[n - 1 - i]
	for i in range(len(a)):
		if start[i] * end[i] == 1:
			possible = True
	if possible:
		print('YES')
	else:
		print('NO')


def solve(a, n):
	end_left_hill = 0
	while end_left_hill < n and a[end_left_hill] >= end_left_hill:
		end_left_hill += 1
	end_right_hill = n - 1
	while end_right_hill >= 0 and a[end_right_hill] >= n - 1 - end_right_hill:
		end_right_hill -= 1
	end_right_hill += 1
	if end_right_hill >= end_left_hill:
		return False
	for i in range(end_right_hill, end_left_hill):
		if a[i] >= max([i, n - 1 - i]):
			return True
	return False
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	print('Yes' if solve(a, n) else 'No')


t = int(input())
for _ in range(t):
	n = int(input())
	seq = list(map(int, input().split()))
	(pend, send) = (-1, n)
	for i in range(n):
		if seq[i] < i:
			break
		pend = i
	for i in range(n - 1, -1, -1):
		if seq[i] < n - 1 - i:
			break
		send = i
	if send <= pend:
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	l = -1
	for i in range(n):
		if a[i] < i:
			break
		l += 1
	r = -1
	for i in range(n):
		if a[n - i - 1] < i:
			break
		r += 1
	if r + 1 + l + 1 >= n + 1:
		print('YES')
	else:
		print('NO')


def get1(tmp1, arr):
	for i in range(1, n):
		if arr[i] >= i and tmp1[i - 1] == 1:
			tmp1[i] = 1
	return tmp1
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	tmp1 = [0 for i in range(n)]
	tmp2 = [0 for i in range(n)]
	tmp1[0] = 1
	tmp1 = get1(tmp1, arr)
	tmp2[n - 1] = 1
	for i in range(n - 2, -1, -1):
		l = n - i - 1
		if arr[i] >= l and tmp2[i + 1] == 1:
			tmp2[i] = 1
	flag = False
	for i in range(n):
		if tmp1[i] == 1 and tmp2[i] == 1:
			flag = True
	if flag:
		print('Yes')
	else:
		print('No')


test = int(input())
for _ in range(test):
	N = int(input())
	LIST = list(map(int, input().split()))
	F = 0
	if N % 2 == 0:
		n = N // 2 - 1
	else:
		n = N // 2 + 1
	for i in range(n):
		ans = LIST[N - 1 - i] - i
		res = LIST[i] - i
		if ans < 0 or ans > LIST[N - 1 - i] or res < 0 or (res > LIST[i]):
			F = 1
			break
	if F == 1:
		print('No')
	elif N % 2 == 0:
		if LIST[N // 2 - 1] >= N // 2 - 1 and LIST[N // 2] >= N // 2 or (LIST[N // 2 - 1] >= N // 2 and LIST[N // 2] >= N // 2 - 1):
			print('Yes')
		else:
			print('No')
	elif LIST[N // 2] >= N // 2:
		print('Yes')
	else:
		print('No')


for VS14 in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	pre = -1
	suf = n
	for t in range(n):
		if l[t] < t:
			break
		pre = t
	for t in range(n - 1, -1, -1):
		if l[t] < n - 1 - t:
			break
		suf = t
	if pre >= suf:
		print('Yes')
	else:
		print('No')