The peak of a mountain
heights strictly increases up to one peak and then strictly decreases, with at least
three values. Write peak_index(heights) that returns the index of the peak.
peak_index([1, 3, 5, 4, 2]) -> 2
peak_index([0, 10, 5]) -> 1
The point is to practise binary search where the comparison is between a value and its neighbour rather than against a target.
def peak_index(heights):
...