Suppose a sorted array is rotated at some pivot unknown to you beforehand.
(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).
Find the minimum element.
代码如下:
1 public class Solution { 2 public int findMin(int[] nums) { 3 Arrays.sort(nums); 4 return nums[0]; 5 } 6 }
浙公网安备 33010602011771号