SHARE
TWEET

Untitled

a guest Aug 25th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Solution {
  2. public:
  3.     static int peakIndexInMountainArray(const vector<int>& A) {
  4.         int f=1, t=A.size()-2;
  5.         while (f < t) {
  6.             int m = f+(t-f)/2;
  7.             if (A[m] < A[m+1])
  8.                 f = m+1;
  9.             else
  10.                 t = m;
  11.         }
  12.         return f;
  13.     }
  14. };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top