Question: A peak item in an array is the item that is greater than its neighbors. If there are more than one peak item, simply return
A peak item in an array is the item that is greater than its neighbors. If there are more than one peak item, simply return one of them.
Input: [1, 5, 3, 2, 4, 0]
Output: 4
Input: [1, 2, 3, 4, 5, 6]
Output: 6
Input: [7, 6, 5, 4, 3, 2]
Output: 7
Describe a divide-and-conquer algorithm that solves this problem in O(log n) time where n is the size of the array.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
