题解 | #旋转数组的最小数字#
旋转数组的最小数字
http://www.nowcoder.com/practice/9f3231a991af4f55b95579b44b7a01ba
# -*- coding:utf-8 -*-
class Solution:
def minNumberInRotateArray(self, rotateArray):
# write code here
if not rotateArray:return None
left,right=0,len(rotateArray)-1
while left<right:
mid=(left+right)//2
if rotateArray[mid]>rotateArray[right]:
left=mid+1
elif rotateArray[mid]<rotateArray[right]:right=mid
else: right-=1
return rotateArray[left]
题解-数据结构与算法 文章被收录于专栏
小菜鸟的题解