You are viewing a single comment's thread. Return to all comments →
from collections import deque for _ in range(int(input())): n = int(input()) d = deque(map(int, input().split())) current = d.popleft() if d[0] >= d[-1] else d.pop() for _ in range(n-1): if current < d[0] or current < d[-1]: print('No') break else: if d[0] >= d[-1]: current = d.popleft() else: current = d.pop() if not d: print('Yes')
Seems like cookies are disabled on this browser, please enable them to open this website
Simple Game
You are viewing a single comment's thread. Return to all comments →