Only 3 test cases are passing

I don’t understand why my solution is not working, I have implemented a comparator that takes two strings and compares them lexically.

@Sayon-Palit-2873308702757758 hey please send me link of code.

#include<bits/stdc++.h> using namespace std; bool compare(int a, int b){ string astr = to_string(a); string bstr = to_string(b); return astr.append(bstr)>bstr.append(bstr); } int main() { int t; cin>>t; while(t–){ int n; cin>>n; int arr[100]; for(int i = 0;i<n;i++){ cin>>arr[i]; } sort(arr,arr+n,compare); for(int i = 0;i<n;i++){ cout<<arr[i]; } cout<<endl; } return 0; }

@Sayon-Palit-2873308702757758 hey ,I have changed your code ,ap input lete hue hi string me change kro array ko:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.