Form Biggest Number doubt string

#include
#include
#include
using namespace std;
int main()
{
int t;
cin>>t;
while(t–)
{
int n;
cin>>n;
string a[n];
for(int i=0;i<n;i++)
cin>>a[i];
sort(a,a+n);
for(int i=n-1;i>=0;i–)
cout<<a[i];
}
return 0;
}
getting wrong answer dont know why

@Tribhav_Chaudhary hey tribhav this is not a reverse no program here you have to here design a custom comparator which help you to sort the number in such a way that the given no will form up a large number

i have not reversed the number.
firstly i have taken the numbers as strings
then sorted them that means they are now arranged in increasing order based on ascii value.
then printed them in reverse order to get the maximum number.
can you please tell me the test case which will not pass

@Tribhav_Chaudhary hey tribhav ok let consider your logic with sample case
8
1 34 3 98 9 76 45 4
if you sort these numbers then
sorted number is
1 3 4 9 34 45 76 98
now reverse
987645349431
but actually the output should be
998764543431
now design a compare function which will passed with sort function
hint of compare function
int find_largest(string X,string Y){
string XY = X.append(Y);
string YX = Y.append(X);
return XY.compare(YX) > 0 ? 1: 0;
}

thank you very much i understand the logic

@Tribhav_Chaudhary happy coding tribhav