classSolution:# @param num: a rotated sorted array# @return: the minimum number in the arraydeffindMin(self,num):# write your code hereifnum==Noneorlen(num)==0:return0front=0end=len(num)-1result=sys.maxintwhilefront<=endandfront>=0:mid=(front+end)/2# case 1: no in orded subarrayifnum[front]>num[end]:front=mid+1else:# case 2: already in a orded subarray, search for the lowest valueifresult>num[front]:result=num[front]front-=1end=mid-1returnresult