class Solution { public int findMin(int[] nums) { int left = 0, right = nums.length - 1; int min = Integer.MAX_VALUE; // 宗旨 每次转换下标的时候,都会记录更新一下min while(left <= right) { int mid = (left + right) / 2; if(left <= right && nums[left] == nums[mid]) { left++; min = Math.min(min, nums[mid]); continue; } if(left > right) return min; if(nums[left] < nums[mid]) //left part in order { min = Math.min(min, nums[left]); left = mid + 1; } else { min = Math.min(min, nums[mid]); right = mid - 1; } } return min; } }