#include
#include
using namespace std;
int main()
{
int arr[100];
int n;
cin>>n;
for(int i=0;i<n;i++)
cin>>arr[i];
next_permutation(arr,arr+n);
for(int i=0;i<n;i++)
cout<<arr[i]<<" ";
}
#include
#include
using namespace std;
int main()
{
int arr[100];
int n;
cin>>n;
for(int i=0;i<n;i++)
cin>>arr[i];
next_permutation(arr,arr+n);
for(int i=0;i<n;i++)
cout<<arr[i]<<" ";
}
hey @Harshit-Kumar-2577121455897279 in questions you are being provided test cases as well you are not taking them into consideration, moreover the size of array could be upto 1000 but you have taken it as 100 only.
Here is your corrected code for reference purpose:
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.