classSolution { public: intpeakIndexInMountainArray(vector<int>& a){ int l = 0; int r = a.size()-1; while(l<r) { int m = l + (r-l) /2; int ml = l + (m-l)/2 ; int mr = r - (r-m) / 2; // cout<<m<<" "<<l<<" "<<r<<" "<<ml<<" "<<mr<<endl; if(a[ml]>=a[mr]) { r = mr-1; } elseif(a[ml]<a[mr]) { l = ml+1; } } return l; } };