Since nums[-1] = nums[n] = INT_MIN, a valid solution is guaranteed to exist.

```
class Solution {
public:
int findPeakElement(vector<int>& nums) {
int l = 0, r = nums.size();
while (l+1 < r) {
int m = (l+r)/2;
if (m && nums[m] < nums[m-1])
r = m;
else
l = m;
}
return l;
}
};
```