#852

Peak Index in a Mountain Array

medium · 66.9% accepted · 8,466 likes · top 73%

array · binary search

⊣ practice⊣ open on leetcode ↗

Description

You are given an integer mountain array arr of length n where the values increase to a peak element and then decrease.

Return the index of the peak element.

Your task is to solve it in O(log(n)) time complexity.

Solution