Largest number....works on test input but not passing all the test cases

why it is wrong ???

Change your comparator function to
bool cmp(string s1,string s2)
{
return s1+s2>s2+s1;
}

@keshavgupta0103
why so ??

what is wrong in mine
where it is failing ???
and how it is failing

2
9 98

Your code gives 989 as answer, it should be 998