int findMin(int[] num) {
int start = 0, end = num.length - 1;
while (start < end) {
int mid = start + (end - start) / 2;
if (num[mid] < num[end])
end = mid;
else
start = mid + 1;
}
return num[start];
}
int findMin(int[] num) {
int start = 0, end = num.length - 1;
while (start < end) {
int mid = start + (end - start) / 2;
if (num[mid] < num[end])
end = mid;
else if (num[mid] > num[end])
start = mid + 1;
else
end--;
}
return num[start];
}
参考:http://bangbingsyb.blogspot.com/2014/11/leecode-find-minimum-in-rotated-sorted.html