• + 0 comments

    T = int(input()) for j in range(T): n = int(input()) blocks = list(map(int, input().split())) result = True left, right = 0, n-1 top = float('inf') while left <= right: if blocks[left] <= top and (blocks[left] >= blocks[right]): top = blocks[left] left += 1 elif blocks[right] <= top: top = blocks[right] right -= 1 else: result = False break

    print("Yes" if result else "No")