Next Permutation Problem

i am not able to pass all the test cases.4/5 are passed.Only 1 is not able to pass and i don’t why.

@S18LP0113
hello sourabh,
pls save ur code on https://ide.codingblocks.com/ and then share the link

https://ide.codingblocks.com/s/195384 here is the code for this

@S18LP0113
no need for extra b array or any other logic.
just call next permutation and thenprint the resultant array.

what about the case when no next permutation exists…?

function will handle that as well ,it will give u smallest permution in that case

Thanks a lot :slight_smile: for your help