leetcode 852

和 162 一毛一样, 意义何在?

class Solution:
    def peakIndexInMountainArray(self, arr: List[int]) -> int:
        start = 0
        end = len(arr) - 1
        while start < end:
            mid = (start + end) // 2
            if arr[mid] < arr[mid + 1]:
                start = mid + 1
            else:
                end = mid
        return start
posted @ 2021-11-21 19:43  茫茫碧落  阅读(26)  评论(0编辑  收藏  举报