• + 0 comments

    I am not sure when did things turned into the wrong but i got all of my test case right except for the first two one's possible = True for _ in range(int(input())): block = int(input()) block_dict = list(int(i) for i in list(input().split())) answers = [block_dict[0] if block_dict[0] > block_dict[-1] else block_dict[0] if len(block_dict) == 1 else block_dict[-1]] block_dict.remove(answers[0]) for i in range(len(block_dict)): x = max(block_dict[0], block_dict[-1]) if len(block_dict) > 1 else block_dict[0] if x <= answers[i]: answers.append(x) else: possible = False break print("Yes" if possible else "No")