max element index in vector c++ code example
Example 1: max of a vector c++
cout<<*max_element(a.begin(), a.end())<<endl;
Example 2: max element in vector c++
auto max = *max_element(vector.begin(), vector.end());
Example 3: return the index where maximum element in a vector
// my linkedin : https://www.linkedin.com/in/vaalarivan-prasanna-3a07bb203/
cout << distance(vec.begin(), max_element(vec.begin(), vec.end()));