Leetcode 852. Peak Index in a Mountain Array | | Leetcode 852. Peak Index in a Mountain Array 文章作者:Tyan博客:noahsnail.com | CSDN | 简书 1. Description 2. Solution1234567891011121314151617class Solution {public: int peakIndexInMountainArray(vector<int>& A) { int left = 0; int right = A.size() - 1; while(left < right) { int mid = (left + right) / 2; if(A[mid] > A[mid + 1]) { right = mid; } else { left = mid + 1; } } return left; }}; Reference https://leetcode.com/problems/peak-index-in-a-mountain-array/description/ 如果有收获,可以请我喝杯咖啡! 赏 微信打赏 支付宝打赏