private int findPeakHelper(int[] nums, int low, int high) {
        if (low == high) return low;
        if (low == high - 1)
            return nums[low] > nums[high] ? low : high;
        int mid = (low + high) / 2;
        if (nums[mid] > nums[mid - 1] && nums[mid] > nums[mid + 1])
            return mid;
        if (nums[mid] > nums[mid - 1])
            return findPeakHelper(nums, mid + 1, high);
        else
            return findPeakHelper(nums, low, mid - 1);
    }