代码:
java
class Solution {
public int findMin(int[] nums) {
int n = nums.length;
if(nums[0]<nums[n-1])return nums[0];
int l=0,r=n-1;
while(l<r){
int m = (l+r)/2;
if(m==l||m==r)break;
if(nums[l]>nums[m]){
r=m;
}else if(nums[m]>nums[r]){
l=m;
}
}
return nums[r];
}
}