Peak Index in a Mountain Array

给一个数组, 找一个index,比左大比右小, 这个题前提是这个index一定存在, 省去很多corn cases的判断, 直接二分找

class Solution {
    public int peakIndexInMountainArray(int[] A) {
        int start = 0, end = A.length - 1;
        while (start < end) {
            int mid = start + (end - start) / 2;
            if (A[mid] < A[mid + 1])
                start = mid + 1;
            else
                end = mid;
        }
        return start;
    }
}