Recursion- Dictionary Order(Larger)

Why is it failing all the test cases…?

Hey @Karanveer,

Your code is not printing the output in the sorted order.
I have corrected your code:

Hope, this would help.

https://ide.codingblocks.com/s/266304 if i do backtracking (in line no. 25), would it make any change…?

Hello @Karanveer,

In that case you would require to store the strings in a vector and then in the main after sorting that vector, print the strings.

if we don’t do the backtracking part we wont get all the permutations right?? if yes, then why are we not doing the backtracking part here…

Hey @Karanveer,

I would suggest you to dry run your code to understand this batter.
Dry run both the codes for the same example say bac

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.