I am getting WA for this code, but it is correct for all sample cases. Can anyone help me out?
Also I am new to codechef so is there a way to fetch testcases?
for tc in range(int(input())):
n = int(input())
li = list(map(int,input().split(' ')))
first_half = []
second_half = []
if li[0]==1 and li[-1]==1:
mid = n//2 + 1
first_half = li[:mid]
second_half = li[mid-1:]
for i in range(len(first_half)-1):
if first_half[i+1] - first_half[i] == 1:
flag = 0
else:
flag=1
break
second_half.reverse()
if second_half[i] == first_half[i]:
flag = 0
else:
flag = 1
if flag ==0:
print('yes')
else:
print('no')
else:
print('no')