human
I am working on the file "02_BinarySearch.ipynb".
The first task is:
Related: Find Peak Element

https://leetcode.com/problems/find-peak-element/#/description
Can you write Python program for it?
assistant
#Here is Python program to find Peak Element
.

class Solution(object):
    def findPeakElement(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """
        if nums is None or len(nums) == 0:
            return -1
        n = len(nums)
        if n == 1:
            return 0
        
        start, end = 0, n-1
        while start + 1 < end:
            mid = start + (end - start) / 2
            if nums[mid] > nums[mid-1] and nums[mid] > nums[mid+1]:
                return mid
            elif nums[mid] < nums[mid+1]:
                start = mid
            else:
                end = mid
        
        return start if nums[start] > nums[end] else end