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