Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution {
- public:
- static int peakIndexInMountainArray(const vector<int>& A) {
- int f=1, t=A.size()-2;
- while (f < t) {
- int m = f+(t-f)/2;
- if (A[m] < A[m+1])
- f = m+1;
- else
- t = m;
- }
- return f;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement