```
public int findMin(int[] nums) {
int len = nums.length;
if(nums == null || len == 0) return 0;
int l = 0 , r = len-1;
int mid =0;
while(l<=r)
{
mid = l + (r-l)/2;
if(nums[mid] >= nums[len-1]) l = mid+1;
else r = mid -1;
}
return nums[mid]>nums[len-1]?nums[mid+1] : nums[mid];
}
```