标签:style blog color io ar sp div on log
很眼熟。。。就是一个二分。。。
class Solution { public: int findMin(vector<int> &num) { int size = num.size() - 1; int l = 0; int r = size; while(l <= r) { int mid = l + (r - l) / 2; if (num[mid] > num[size]) { //left l = mid + 1; } else { r = mid - 1; } } return num[l]; } };
[leetcode]Find Minimum in Rotated Sorted Array
标签:style blog color io ar sp div on log
原文地址:http://www.cnblogs.com/x1957/p/4028271.html