LeetCode-Find Minimum in Rotated Sorted Arrays

public class Solution {
    public int findMin(int[] num) {
        for ( int i = 0; i < num.length-1; i ++ ){
            if ( num[i] > num [ i+1] )
                return num[i+1];
        }
        return num[0];
    }
}
感觉要是面试面这个 就可以去买彩票了。。。

你可能感兴趣的:(LeetCode-Find Minimum in Rotated Sorted Arrays)