```
public class Solution {
public int findMin(int[] nums) {
int r = nums.length;
while (--r > 0 && nums[r] == nums[r - 1]);
if (r == 0) return nums[0];
int lo = 0;
int hi = r + 1;
while (hi - lo > 1) {
int mid = lo + hi >> 1;
if (nums[mid] >= nums[0])
lo = mid;
else
hi = mid;
}
return nums[hi % (r + 1)];
}
}
```