#852

Peak Index in a Mountain Array

specialist · 630 · lc medium +30 · 66.9% accepted · 8,466 likes · top 73%

Description

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

Return the index of the peak element.

Solve this in O(log(n)) time.

Code

1
2
3