I have written the code , there is no compilation error, but it is showing the wrong output.
The code is:
#include
#include
using namespace std;
int main() {
int t;
cin>>t;
int N;
cin>>N;
while(t--)
{
int arr[] = {1,2,3,4,5,6,7,8,9};
int n = sizeof(arr)/sizeof(int);
for(int i=0;i<N;i++)
{
cin>>arr[i];
}
next_permutation(arr,arr+N);
for(int x:arr)
{
cout<<x<<" ";
}
}
return 0;
}
