标签:
Suppose a sorted array is rotated at some pivot unknown to you beforehand.
(i.e., 0 1 2 4 5 6 7 mightbecome 4 5 6 7 0 1 2).
Find the minimum element.
You may assume no duplicate exists in the array.
HideTags
int findMin(vector<int> &num) { int size = num.size(); for (int i = 0; i < size - 1; i++) if (num[i]>num[i + 1]) return num[i + 1]; return num[0];//num升序排列,没有转置 }
153.Find Minimum in Rotated Sorted Array
标签:
原文地址:http://blog.csdn.net/hgqqtql/article/details/43707415