321
社区成员




Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]). Find the minimum element. You may assume no duplicate exists in the array. (注意:测试用例仅做参考,我们会根据代码质量进行评分)
。。。。。我不懂英语啊。。。还好题目是中文的
n = int(input())
arr = list(map(int,input().split()))
print(min(arr))
js 数组,老顾暂时没有发现类似 min 的方法,所以还是排序吧
n = parseInt(readline())
arr = Array.from(readline().split(' ')).map(x => parseInt(x))
print(arr.sort((x,y)=>x>y?1:-1)[0])