in my code -“https://ide.codingblocks.com/s/97086”
why it is wrong for others
and in dictionary we get all the in ascending sorted order,but in question it is something else
Why i am getting wrong answer? in problem RECURSION-DICTIONARY ORDER(smaller)
please help help help
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.
where you have cleared ?
Hi Ayush
I get your question, this I also need to confirm. @sanjeetboora Can you pls clear in which order does the question demand the output?
It is not ascending as per the test cases.
is someone gonna reply or not ? what’s this ?
Hi @Ayusinha
Extremely sorry for the late response.
Regarding your doubt:
for input:
cab
you will get the output:
acb
abc
bca
bac
So, the question isn’t saying that you need to print the output in lexico or dictionary order, it says that output should be all the permutations which are lexicographically smaller than the given string.
Regarding the order of the output, when you will be using simple permutation function to print all the permutations of the given string, you will get this order automatically.
If you are using char array instead of string and performing backtracking at every step, then order of your output may vary but if you using string (in this approach there is no need to backtrack), you will get the same order of the output.