```
class Solution:
# @param nums, an integer[]
# @return an integer
def findPeakElement(self, nums):
l, r = 0, len(nums) - 1
while l < r:
mid = l + (r - l) / 2
if nums[mid] > nums[mid + 1]:
r = mid
else:
l = mid + 1
return l
```

This is a question to find upper bound, namely to find the first element nums[i] > nums[i + 1] from left-end.