题解 | #旋转数组的最小数字#
旋转数组的最小数字
http://www.nowcoder.com/practice/9f3231a991af4f55b95579b44b7a01ba
import java.util.ArrayList;
public class Solution {
public int minNumberInRotateArray(int [] array) {
return minNumberInRotateArrayDg(array,0,array.length-1);
}
public int minNumberInRotateArrayDg(int [] array,int s,int e) {
if(s>=e){
return array[s];
}
int c = (e-s)/2 + s;
return Math.min(minNumberInRotateArrayDg(array,s,c),minNumberInRotateArrayDg(array,c+1,e));
}
}