Sort Game code doubt


it is giving wrong output for test cases

hey @chahatkumar, in line 24 of your code make it >= instead of >. Also update you compare function to this
bool compare(pair<string,int> p1,pair<string,int> p2)
{
if(p1.second != p2.second)
return p1.second>p2.second;
else
return p1.first<p2.first;
}

okay sir
but if we do : " return p1.first<p2.first " it will check only the first char of both the strings,?

hey @chahatkumar, no it will check complete string

okay thanks :slight_smile:

hey @chahatkumar , if your query is resolved. Please mark this doubt as resolved and rate me on the basis of your experience.
rating option will appear when to mark this doubt as resolved

1 Like