Element in Bitonic Array
Let's try to conduct a binary search of a bitonic array. Difficulty Level: Medium
Problem statement
Suppose we are given an integer array, nums
, which is guaranteed to be a bitonic array and a target value. It will return the index if the target is found. If not, it will return -1
.
Constraints:
-
-
-
A given array always contains a bitonic point.
-
Array
nums
always contain distinct elements.
Example 1:
Input: [3, 9, 10, 20, 17, 5, 1], 20
Output: 3
Example 1:
Input: [5, 6, 7, 8, 9, 10, 3, 2, 1], 30
Output: -1
Level up your interview prep. Join Educative to access 70+ hands-on prep courses.