#include
#include
using namespace std;
bool compare(int s1,int s2)
{
auto x = to_string(s1);
auto y = to_string(s2);
return x>y;
}
int main() {
int n;
cin>>n;
while(nā)
{
int t;
cin>>t;
int a[t];
for(int i=0;i<t;i++)
cin>>a[i];
sort(a,a+t,compare);
for(int i=0;i<t;i++)
cout<<a[i];
cout<<endl;
}
return 0;
}
Not working for any of the test case
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 compare(string a,string b)
{
string ab=a+b;
string ba=b+a;
return ab>ba;
}