Advertisement
momo2345

peak index in a mountain array

Jul 11th, 2020
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.18 KB | None | 0 0
  1. class Solution {
  2. public:
  3.     int peakIndexInMountainArray(vector<int>& A) {
  4.         int index=max_element(A.begin(),A.end())-A.begin();
  5.        
  6.         return index;
  7.     }
  8. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement