Hi, I don't know why the judge tell me my solution is wrong.

Here is the code:

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

The input of the judge is [2, 1, 2], and I return 0, as nums[0] > nums[-1] and nums[0] > nums[1].