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.
I know the expectation is to use deque to solve this. But still went ahead with a simpler approach.
test_cases = int(input())
for i in range(test_cases):
ln = int(input())
blocks = list(map(int, input().split()))
if max(blocks) == blocks[0] or max(blocks) == blocks[-1]:
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 →
I know the expectation is to use deque to solve this. But still went ahead with a simpler approach.
test_cases = int(input()) for i in range(test_cases): ln = int(input()) blocks = list(map(int, input().split())) if max(blocks) == blocks[0] or max(blocks) == blocks[-1]: print("Yes") else: print("No")