Question-Given a string containing duplicates, print all its distinct permutations such that there are no duplicate permutations and all permutations are printed in a lexicographic order.
Example-
Input-ABA
Output-
AAB
ABA
BAA
Here is where i took help from-
NOTE–There is also Python and Java implementation code given in description, but i am not familiar with that languages much
It’s algorithm-
1.To maintain a count array of all characters
2.if count is >0 we add that char to our output string and decrement the count
3.if count == len of inp string we print the output string
4.We add the count again to backtrack it
My Implementation-
I don’t know where i am doing wrong in implementation or thinking but it isn’t producing any output.
Please anyone can help?