You are viewing a single comment's thread. Return to all comments →
from collections import deque for t in range(int(input())): m, b = int(input()), deque(map(int, input().split(" "))) o = deque() while b: o.appendleft(b.popleft()) if b[0] > b[-1] else o.appendleft(b.pop()) if len(o) > 1 and o[0] > o[1]: print("No") break else: print("Yes")
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 →