GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — leetcode/python/852_Peak_Index_in_a_Mountain_Array.py at master · qiyuangong/leetcode Expand file tree/ Copy path852_Peak_Index_in_a_Mountain_Array.pyMore file actions 20 lines (19 loc) · 494 Bytes / Copy path852_Peak_Index_in_a_Mountain_Array.pyFile metadata and controls20 lines (19 loc) · 494 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 class Solution(object): # def peakIndexInMountainArray(self, A): # """ # :type A: List[int] # :rtype: int # """ # i = 0 # while A[i + 1] >= A[i]: # i += 1 # return i def peakIndexInMountainArray(self, A): lo, hi = 0, len(A) - 1 while lo < hi: mid = (lo + hi) / 2 if A[mid] < A[mid + 1]: lo = mid + 1 else: hi = mid return lo |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |