this code is running fine…i checked it on the IDE but it fails all the test-cases.
Problem in code
Your code is failing on cases like : 1
2
330 33
Here, your code gives output as 33033 whereas answer is 33330.
To remove this ambiguity you can use an approach as follows: Take all the numbers in input as strings.
Then sort the strings based on an externally defined comparator defined as follows:
bool comp(string a,string b)
{
string ab = a+b;
string ba = b+a;
return ab>ba;
}
Hope it Helps.
but i checked for this test case without editing the code and its working fine?
No, I just checked the above link again. It still gives output as 33033.