Live Batches
Masterclasses
Menu
Free Courses
Account
Login / Sign Up

Bitonic Point

Easy Acceptance 58.67% Points 20.00

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.

Examples
Example 1

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

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.

Hints
Hint 1
Expected Time Complexity: O(log n)
Hint 2
Expected Auxiliary Space: O(1)
Constraints
  • 3 <= arr.size() <= 10^5
  • 1 <= arr[i] <= 10^6
Companies
Amazon Microsoft Flipkart
Topics
Searching Algorithm
Solution.cs C#JavaPythonC++Javascript

Unlock the code editor

Sign in to write, run, and submit your solution against the full test suite.

  • Run code against sample & hidden test cases
  • Save submissions and track your streak
  • Compare with editorial & community solutions