Regarding pair class

Suppose we have 5 pair class and I want to sort in such a way if second is largest then it should come first and is some pairs have same second then those who have first largest should come first so in compare function I wrote
bool compare(pair a, pair b)
return a.second<b.second
If(a.second==b.second)
Return a.first>b.first

This is not giving correct answer

@ritikgupta3008
hello ritik,
put ur if statement before ur return statement ,it will work

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.