':type nums: List[int]
:rtype: int'

def findPeakElement(self, nums):

    (left, right) = (0, (len(nums) - 1))
    while (left < right):
        mid = (left + ((right - left) / 2))
        if (((mid == 0) or (nums[(mid - 1)] < nums[mid])) and (((mid + 1) == len(nums)) or (nums[mid] > nums[(mid + 1)]))):
            return mid
        elif (not ((mid == 0) or (nums[(mid - 1)] < nums[mid]))):
            right = mid
        else:
            left = (mid + 1)
    return left
