LeetCode: 852. Peak Index in a Mountain Array
Intuition
Use the tendence of the middle element to check either the required index is in the left or right of the middle element.
Approach
Complexity
Time complexity: \(O(\log n)\)
Space complexity:
Code
1 |
|
LeetCode: 852. Peak Index in a Mountain Array
http://blog.slray.com/2025/02/13/LeetCode-852-Peak-Index-in-a-Mountain-Array/