题目信息:
思路:二分法查找:
<span style="font-size:18px;">class Solution: # @param num, a list of integer # @return an integer def findMin(self, num): start = 0 end = len(num) - 1 while num[start] > num[end]: middle = (start + end )/2 if num[middle] > num[start]: start = middle + 1 else: end = middle return num[start]</span>
<span style="font-size:18px;"># class Solution: # # @param num, a list of integer # # @return an integer # def findMin(self, num): # num.sort() # return num[0]</span>直接排序竟然也行,汗。。。。。
Find Minimum in Rotated Sorted Array
原文:http://blog.csdn.net/hongkangwl/article/details/41653073