Download Find Peak Element.py
# class Solution(object): # def findPeakElement(self, nums): # """ # :type nums: List[int] # :rtype: int # """ class Solution(object): def findPeakElement(self, nums): # https://leetcode.com/discuss/88467/tricky-problem-tricky-solution # note that num[-1] = num[n] = -∞ start, end = 0, len(nums) - 1 while start < end: mid = (start + end) / 2 if nums[mid] < nums[mid+1]: start= mid + 1 else: end = mid return start
Leetcode 162 Find Peak Element problem solution in python3 with explanation. This is the best place to expand your knowledge and get prepared for your next interview.
:type nums: List[int]
Feedback is the most important part of any website.
If you have any query, suggestion or feedback, Please feel free to contact us.