I add -infinity to the end of nums in order to avoid all boundary checks.

Then I simply find the first element which is bigger than its next one.

```
def findPeakElement(self, nums):
nums.append(float('-inf'))
return next(i for i in range(len(nums) - 1) if nums[i] > nums[i + 1])
```