Leetcode requires logarithmic complexity, so one would naturally consider using binary search. But how to prove it?

```
int findPeakElement(vector<int>& nums) {
int sz = nums.size();
int low = 0, high = sz-1;
while(low < high) {
int mid = (low+high)>>1;
if(mid+1 < sz && nums[mid] < nums[mid+1]) low = mid+1;
else if(mid >= 1 && nums[mid] < nums[mid-1]) high = mid;
else return mid;
}
return low;
}
```