We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
t=int(input())for_inrange(t):n=int(input())blocks=list(map(int,input().split()))left,right=0,n-1last=float('inf')#startwith"infinity"(norestrictionyet)ok=Truewhileleft<=right:# choose the bigger cube from either endifblocks[left]>=blocks[right]:curr=blocks[left]left+=1else:curr=blocks[right]right-=1# check if it's validifcurr>last:ok=Falsebreaklast=currprint("Yes"ifokelse"No")
Cookie support is required to access HackerRank
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 →