You are viewing a single comment's thread. Return to all comments →
for t in range(int(input())): n = int(input()) lst = list(map(int, input().split())) result = 'Yes' previous_item = None while lst: if lst[0] >= lst[-1]: current_item = lst.pop(0) else: current_item = lst.pop(-1) if previous_item: if current_item > previous_item: result = 'No' break previous_item = current_item print(result)
Seems like cookies are disabled on this browser, please enable them to open this website
Piling Up!
You are viewing a single comment's thread. Return to all comments →