how to sort vector of pair decreasing order in C++?

Trying to sort an vector<pair<int,int>> decreasing order in C++.

sort(v.begin(),v.end(),greater<int> ())

>Solution :

The elements of your vector are pair<int,int>, so you should use greater<pair<int,int>> () instead of greater<int> ().

Leave a Reply