153. Find Minimum in Rotated Sorted Array

先问了Hash, what happen if there is a collision?

public class Solution {
    public int findMin(int[] nums) {
        if(nums==null||nums.length==0) return 0;
        if(nums.length==1) return nums[0];
        int start=0,end=nums.length-1;
        while(start0&&nums[mid]=nums[start]&&nums[mid]>nums[end]) start=mid+1;
            else end=mid-1;;
        }
        return nums[start];
    }
}

你可能感兴趣的:(153. Find Minimum in Rotated Sorted Array)