题解 | #旋转数组的最小数字#
旋转数组的最小数字
http://www.nowcoder.com/practice/9f3231a991af4f55b95579b44b7a01ba
java二分法查找最小值 import java.util.*; public class Solution { public int minNumberInRotateArray(int [] array) { if (array.length == 0){ return 0; } int left = 0; int right = array.length - 1; while (left < right){ int mid = (left + right) >> 1; if (array[mid] > array[right]){ left = mid + 1; }else if (array[mid] < array[right]){ right = mid; }else { right --; } } return array[left]; } }