Search⌘ K
AI Features

Peak Index in a Mountain Array

Try to solve the Peak Index in a Mountain Array problem.

We'll cover the following...

Statement

Given an integer array arr that is guaranteed to be a mountain array, return the index of its peak element. The peak is the element that is strictly greater than its adjacent elements, where values strictly increase up to the peak and then strictly decrease after it.

Note: A mountain array has some index i such that arr[0] < arr[1] < ... < ...