My issue
not able to solve the problem
My code
# cook your dish here
t = int(input())
for _ in range(t):
n = int(input())
prob = list(map(int, input().split()))
for i in range(1, n):
if prob[i] >= prob[i-1]:
continue
else:
print("No")
break
print("Yes")
Learning course: Arrays using Python
Problem Link: CodeChef: Practical coding for everyone
@shreetej07
plzz refer the following pyth code for better understanding
# cook your dish here
T=int(input())
for i in range(T):
n = int(input())
dop = []
dop =(input().split(' '))
dop=[int(x) for x in dop]
flag=False
for j in range(n-1):
if(dop[j] > dop[j+1]):
flag=True
if(flag == False):
print('YES')
else:
print('NO')
t = int(input())
for _ in range(t):
n = int(input())
prob = list(map(int, input().split()))
non_decreasing = True # Flag to track if problems are in non-decreasing order
for i in range(1, n):
if prob[i] < prob[i - 1]: # If the current problem is less than the previous one
non_decreasing = False # Set the flag to False
break # No need to check further, break out of the loop
if non_decreasing:
print("Yes")
else:
print("No")