Form biggest number


why is this logic wrong?

Consider a case:
1
2
98 9

Expected O/p:
998

Your O/p:
989

The custom compare function must be something like this:
bool mycompare(string a,string b)
{
string ab=a+b;
string ba=b+a;
return ab>ba;
}

1 Like