Whats wrong in this?

#include
#include

using namespace std;

int main()
{
int t;
cin >> t;
while (t > 0){
int n;
cin >> n;
int arr[n];
for (int i = 0; i < n; i++){
cin >> arr[i];
}
for (int i = 0; i < n; i++){
for (int j = i + 1; j < n; j++){
if (arr[i] == 0){
swap(arr[i],arr[n-1]);
}
int digitx = 0, digity = 0;
int temp = arr[i];
while (temp > 0){
digitx++;
temp /= 10;
}
temp = arr[j];
while (temp > 0){
digity++;
temp /= 10;
}
int xy = (arr[i] * pow(10, digity)) + arr[j];
int yx = (arr[j] * pow(10, digitx)) + arr[i];
if (yx > xy){
swap(arr[i], arr[j]);
}
}
}
for (int i = 0; i < n; i++){
cout << arr[i];
}
cout << endl;
t–;

}


return 0;

}

hi @prachur12_a2595aa1d8b484a4, refer it can be done similar to merge sort technique

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.