STL algorithm function with reverse iterators doesn't work

I need to find minimum element in my array, but if amount of minimum elements more than 1, I need to use the most right one. Consider this code: #include <iostream> #include <algorithm> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> a(n); for (int& x : a) cin >>… Read More STL algorithm function with reverse iterators doesn't work