Next permutation

this is my code and test case 4 is failing may i know why it is failing. Can anyone help me out

@Legendankit
Please don’t use the STL
You need to implement this on your own
Here it a reference to help you out

Can you edit and let me know what’s my actual error.

@Legendankit
Buddy there is no use editing your current code. It is not what the question is about. Please implement next_permutation yourself then we can discuss the question.

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.