GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — leetcode/python/852_Peak_Index_in_a_Mountain_Array.py at master · qiyuangong/leetcode

Expand file tree

/

852_Peak_Index_in_a_Mountain_Array.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
20 lines (19 loc) · 494 Bytes
/

852_Peak_Index_in_a_Mountain_Array.py

Copy path

File metadata and controls

20 lines (19 loc) · 494 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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.