Given an array of integers arr[] that first strictly increases and then potentially strictly decreases, find the bitonic point, which is the maximum element in the array. The bitonic point is the position where elements before it are strictly increasing, and elements after it are strictly decreasing.
Example 1
Input: arr[] = [1, 2, 4, 5, 7, 8, 3]
Output: 8
Explanation: Elements before 8 are strictly increasing [1, 2, 4, 5, 7] and elements after 8 are strictly decreasing [3].
Example 2
Input: arr[] = [10, 20, 30, 40, 50]
Output: 50
Explanation: Elements before 50 are strictly increasing [10, 20, 30 40] and there are no elements after 50.
Approach, complexity and clean code in every language. Sign in to unlock the editorial.
Your submissions, results and runtime history live here. Sign in to start your streak.
10 20 30 40 50
50
1 2 4 5 7 8 3
8