LeetCode 153--- Find Minimum in Rotated Sorted Array

题目链接:LeetCode 153— Find Minimum in Rotated Sorted Array

简单题,实在没什么可说,实现代码如下:

public class Problem153 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub

    }
    public int findMin(int[] nums) {
        for(int i=0;i<nums.length-1;i++){
            if(nums[i+1]<nums[i]) return nums[i+1];
        }
        return nums[0];

    }

}

你可能感兴趣的:(LeetCode,算法)