Finding a Peak

Learn how to find the peak of a sequence through binary search.

We'll cover the following...

Peaks

An element of a sequence is called a peak if it’s greater than all its neighbors. Below, we highlight all peaks of a sequence. Note that the rightmost element is a peak since it’s larger than its single neighbor.

Finding a peak

Consider an integer sequence with distinct unknown integers.

Find (any) peak by revealing the minimum number of elements of this sequence. Try the interactive puzzle below.

Local maximum

Note that any sequence (consisting of distinct integers) contains a peak. For example, the largest element is a peak. The largest element is a global maximum and it is not difficult to show that we need to read the entire sequence to find it; if some element is not revealed, we cannot be sure that it’s not the largest one. At the same time, a peak is a local maximum ...