I took the input converted it into string array and calculated all permutations without duplicates and printed them in the required order and format. To remove duplicates I first calculated all possible answers, sorted them and printed ans[i] if ans[i-1] != ans[i]. I am getting wrong answer. Here is my code : https://ide.codingblocks.com/s/151778
Getting No Output
I think your code will work if you use array instead of string. When you are generating string from given array it is taking only first digit of every element. Example - for array {3, 4, 20} the string generated by your code will be 342.
Also, you shall think of an algorithm that directly generates permutations without repetition since your code may get TLE in some test cases because of extra time taken to generate duplicate ones.
For eg AAAAAAAAAA, you don’t need to generate all permutations.
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.