What am I doing wrong in this problem?

I was just practicing a problem on codechef with the code CARDMGK https://www.codechef.com/problems/CARDMGK In this problem, after solving, we had to check if the given sequence is a non-decreasing sequence or not. My original code is this ->

def checkOrder(L):
	return all(x<=y for x, y in zip(L, L[1:]))
T = int(input())
for x in range(T):
	N = int(input())
	A = input().split()
	A = list(map(int, A))
	minA = min(A)
	idx = A.index(minA)
	temp = sorted(A)
	A = A[idx:] + A[:idx]
	if checkOrder(A):
		print("YES")
	else:
		print("NO")

But if I use this,

def checkOrder(L):
L = [L[-1]] + L
count = 0 
for x in range(len(L)-1):
	if L[x] > L[x+1]:
		count += 1 
if count > 1:
	return False 
return True

For the check order function, the code works correctly. I wanna know what’s the difference, because my logic behind both of them is same. I just wanna where did I mess up?