Search in a Bitonic Array
Problem statement
nums contains distinct values, strictly increasing through one peak and strictly decreasing afterward. Return the index of target, or -1 if absent, in O(log n) time.
Function
searchBitonic(nums: int[], target: int) → intExamples
Example 1
nums = [1,3,10,14,16,7,6,2]target = 3return = 13 occurs on the increasing side.
Constraints
1 <= nums.length <= 10^5.