• 36.3%

https://leetcode.com/problems/find-peak-element/?tab=Description

A peak element is an element that is greater than its neighbors.

Given an input array where num[i] ≠ num[i+1], find a peak element and return its index.

The array may contain multiple peaks, in that case return the index to any one of the peaks is fine.

You may imagine that num[-1] = num[n] = -∞.

Note:

Your solution should be in logarithmic complexity.

my code:

Sequential Search:

8ms, 4.79%, June.21th, 2016

https://leetcode.com/discuss/17793/find-the-maximum-by-binary-search-recursion-and-iteration

Consider that each local maximum is one valid peak.
My solution is to find one local maximum with binary search.
Binary search satisfies the O(logn) computational complexity.

Binary Search: recursion

Binary Search: iteration

#### cpp

Solution 1:

8ms, 4.79%, June.21th, 2016

https://leetcode.com/discuss/17793/find-the-maximum-by-binary-search-recursion-and-iteration

Solution 2:

4ms, 84.77%, June.21th, 2016

https://leetcode.com/discuss/17793/find-the-maximum-by-binary-search-recursion-and-iteration

Solution 3:

#### python

Solution 1:

48ms, 82.40%, June.21th, 2016