Use ternary search , variation of divide and conquer algorithm, to solve it with log(n) performance.

Select middle element and choose left or right part of array, saving invariant n[start] < n[middle] > n[end]

```
int findPeakElement(const vector<int> &n) {
int s=0, e=n.size()-1;
while(s<e){
int c = (e-s)/2+s;
if(n[c]<n[c+1])
s=c+1;
else if ( n[c]<n[c-1])
e=c-1;
else return c;
}
return s;
}
```