Can anyone guide me what is wrong in my code?

#include <bits/stdc++.h>

using namespace std;

bool compare (int a, int b){

string aa = to_string(a);

string bb = to_string(b);

return aa > bb;

}

void solve(){

int n;

cin >> n;

int arr[n];

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;

}

int main(){

int t;

cin >> t;

while(t > 0){

    solve();

    t--;

}

return 0;

}