You are viewing a single comment's thread. Return to all comments →
for i in range(int(input())): l=int(input()) left,right=0,-1 ls=list(map(int,input().split())) prev=0 for k in range(l): ind=0 if ls[left]>ls[right]: ind=left elif ls[right]>ls[left]: ind=right else: ind=left if(ls[ind]<=prev) or (prev==0): prev=ls[ind] ls.pop(ind) if ls==[]: print("Yes") else: print("No")
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 →
This is a solution without any dependencies