Form Biggest Number - C++ Launchpad

Not able to pass the test case
Code Link - https://ide.codingblocks.com/s/151453

Hi Vyom
The function you are using for comparison is incorrect. You should use this :
bool comp(int a, int b){
string s=to_string(a)+to_string(b);
string t=to_string(b)+to_string(a);
return s>t?1:0;
}

Hope it helps
Give a like if you’re satisfied :slight_smile:

I think my function also sort them in same manner, Sample test cases also shows correct output.

Your program simply sorts the array in ascending order and prints it in reverse order. Sample test cases must have been passed due to same output coincidence.
Try running your program on simple test case:
1
2
98 9
It gives wrong answer

Got it. Thank you for your help.