1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| class Solution { public int findMin(int[] nums) { int i = 0; int j = nums.length - 1; while(i <= j){ if (i == j) { break; } int mid = (i+j)/2; if(nums[mid] > nums[j]){ i = mid + 1; }else{ j = mid; } } return nums[i]; } }
|