class Solution {
public int findMin(int[] nums) {
int length = nums.length;
if(length == 0){
return -1;
}
while(length > 1 && nums[length - 1] == nums[0]){
length–;
}
if(nums[length - 1] >= nums[0]){
return nums[0];
}
int left = 0;
int right = length - 1;
while(left <= right){
int mid = left + (right - left) / 2;
if(nums[mid] >= nums[0]){
left = mid + 1;
}else{
right = mid - 1;
}
}
return nums[left];
}
}