So i ran my code on the local IDE and it worked for multiple test cases and the answers i got were correct. But when i submit my answers in CB, the compiler shows wrong answer. Could you please help me fix this issue.
I am pasting the code here as the online CB editor does not show the link to share.
#include
#include
#include
#include
#include<bits/stdc++.h>
using namespace std;
int myCompare(string a, string b){
return a + b > b + a;
}
int main() {
int t;
cin >> t;
while (t–) {
int n;
cin >> n;
string arr[n];
for (int i = 0; i < n; ++i){
cin >> arr[i];
}
sort(arr, arr + n, myCompare);
for (int i = 0; i < n; i++){
cout << arr[i];
}
}
return 0;
}