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.
'''if the largest block isn't in the first or last position to begin with, the blocks are not stackable'''
for _ in range(int(input())):
n = int(input())
blocks = list(map(int, input().split()))
if blocks[0] == max(blocks) or blocks[-1] == max(blocks):
print("Yes")
else:
print("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 →
'''if the largest block isn't in the first or last position to begin with, the blocks are not stackable'''
for _ in range(int(input())): n = int(input()) blocks = list(map(int, input().split())) if blocks[0] == max(blocks) or blocks[-1] == max(blocks): print("Yes") else: print("No")