[LeetCode][Python3] 162. Find Peak Element
2019. 1. 25. 01:15 |
프로그래밍/LeetCode
Problem :
https://leetcode.com/problems/find-peak-element/
My Solution :
class Solution:
def findPeakElement(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
low, high = 0, len(nums)-1
while low < high:
mid = (low + high) // 2
if nums[mid] > nums[mid+1]:
high = mid
else:
low = mid+1
return low
'프로그래밍 > LeetCode' 카테고리의 다른 글
[LeetCode][Python3] 300. Longest Increasing Subsequence (0) | 2019.02.10 |
---|---|
[LeetCode][Python3] 240. Search a 2D Matrix II (0) | 2019.02.09 |
[LeetCode][Python3] 103. Binary Tree Zigzag Level Order Traversal (0) | 2019.02.07 |
[LeetCode][Python3] 279. Perfect Squares (0) | 2019.01.31 |
[LeetCode][Python3] 328. Odd Even Linked List (0) | 2019.01.25 |
[LeetCode][Python3] 287. Find the Duplicate Number (0) | 2019.01.25 |
[LeetCode][Python3] 75. Sort Colors (0) | 2019.01.24 |
[LeetCode][Python3] 102. Binary Tree Level Order Traversal (0) | 2019.01.22 |
최근에 달린 댓글 최근에 달린 댓글