import java.util.ArrayList;
public class Solution {
public int minNumberInRotateArray(int [] array) {
if(array.length ==0)
return 0;
int i = 0 , j = array.length-1;
while(i<j){
if(array[i]<array[j])
return array[i];
int min = array[j];
int mid = (i+j)/2;
if(array[mid]>min){
i=mid+1;
}else if(array[mid]<min){
j = mid;
}else{
j--;
}
}
return array[i];
}
}
public class Solution {
public int minNumberInRotateArray(int [] array) {
if(array.length ==0)
return 0;
int i = 0 , j = array.length-1;
while(i<j){
if(array[i]<array[j])
return array[i];
int min = array[j];
int mid = (i+j)/2;
if(array[mid]>min){
i=mid+1;
}else if(array[mid]<min){
j = mid;
}else{
j--;
}
}
return array[i];
}
}