题解 | 有序序列判断
有序序列判断
https://www.nowcoder.com/practice/22e87f8a8d764a6582710f38d1b40c6e
n = int(input())
l1 = list(map(int, input().split()))
l2 = sorted(l1)
l3 = sorted(l1, reverse = True)
if l1 == l2 or l1 == l3:
print('sorted')
else:
print('unsorted')
查看3道真题和解析