Problem
(This problem is an interactive problem.) You may recall that an arrayarr is a mountain array if and only if:
arr.length >= 3- There exists some
iwith0 < i < arr.length - 1such that:arr[0] < arr[1] < ... < arr[i - 1] < arr[i]arr[i] > arr[i + 1] > ... > arr[arr.length - 1]
mountainArr, return the minimum index such that mountainArr.get(index) == target. If such an index does not exist, return -1.
You cannot access the mountain array directly. You may only access the array using a MountainArray interface:
MountainArray.get(k)returns the element of the array at indexk(0-indexed).MountainArray.length()returns the length of the array.
100 calls to MountainArray.get will be judged Wrong Answer.
Examples
Constraints
3 <= mountainArr.length() <= 10^40 <= target <= 10^90 <= mountainArr.get(index) <= 10^9