Some doubt in logic


@aman212yadav

If I am commenting out line no 12 of backtracking the code is not judged but after commenting it out it got accepted with all test cases passed. Accordingly it shouldn’t happen.

@piyush.bansal8158625
which question u r referring?

@piyush.bansal8158625
piyush, (logic for greater string)
see the logic for this problem is simple . first generate all permuation of given string and store all greater strings in vector or set (ur wish) .then sort them (if vector) lexicographicall. and print it.

@piyush.bansal8158625
I m not sure about ur logic.

tricky permutations question…the logic I am asking is of generating permutations.

swapping
recursion
backtracking.

In my code commenting backtracking part makes it submitted with all test cases passed

@piyush.bansal8158625
commenting out line no 12 will not work. because then it will not generate all permuations.

if u r facing any issue in generating permuation then pls watch video again.
or refer this article -> https://www.geeksforgeeks.org/write-a-c-program-to-print-all-permutations-of-a-given-string/

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.