0% completed
Bitonic Array Maximum (easy)
Problem Statement
Find the maximum value in a given Bitonic array. An array is considered bitonic if it is first monotonically increasing and then monotonically decreasing.
In other words, a bitonic array starts with a sequence of increasing elements, reaches a peak element, and then follows with a sequence of decreasing elements. The peak element is the maximum value in the array.
Example 1:
Input: [1, 3, 8, 12, 4, 2]
Output: 12
Explanation: The maximum number in the input bitonic array is '12'.
Example 2:
Input: [3, 8, 3, 1]
Output: 8
Example 3:
.....
.....
.....
J
· 4 years ago
Why and how do the 2 points mentioned in the solution guarantee that the final result or array max is at arr[start] or arr[end] when start == end?
Vu Dao
· 3 years ago
Monotonically increasing or decreasing means that for any index i in the array arr[i] != arr[i+1]. I saw this test case, is it valid? arr[4] == arr[5]
[1, 2, 3, 4, 5, 5, 4, 3, 2, 1]
Anw, I'll update my answer.
lejafilip
· 2 years ago
Your solution return 8 instead of 15 which is correct answer.
Your solution is inccorrect or you are missing important information in description.