I write code but didn’t pass test cases.
help.
#include
#include
using namespace std;
int main() {
int t;
cin>>t;
int n,a[n];
while(t–){
cin>>n;
for(int i=0; i<n; i++){
cin>>a[i];
}
next_permutation(a,a+n);
for(int i=0; i<n; i++){
cout<<a[i]<<" ";
}
cout<<endl;
}
return 0;
}