Recursion Dictionary order smaller

code: https://ide.codingblocks.com/s/78543
unable to pass some test cases. I have solved the question but struggling to print the output in the desired order.

In your code, there is a slight error, firstly you need not to use backtracking to store original array here, remove that line,
and instead of line 15 of your code, you can use bool mycompare function instead of getsmaller function , and u can print the output in the function itself, rather than printing it in the main

if I don’t use backtrack to restore the original array than I am not getting the required output.

You will get the required output, try it again, if u will not be able to, we will help you

code: https://ide.codingblocks.com/s/78543
here is the code where i commented out the backtracking part. Not getting the desired output in this case

I have corrected your code now, try to submit it now

but how does it work evn after removing the backtracking step??

why we don’t need to backtrack here I m not able to get,becoz without we won’t be able to get all permutation of string. what if we miss some of the cases.