Hi ,
I am unable to understand how to approach the problem . I am facing a bit of an issue getting the answer with my code . It would be really helpful if anyone can guide me on how to approach this problem .
Hi ,
I am unable to understand how to approach the problem . I am facing a bit of an issue getting the answer with my code . It would be really helpful if anyone can guide me on how to approach this problem .
Hello @imsharan0105
Write a recursive function that will generate all the permutations of the string.
Terminating condition will be when the passed string is empty, in that case the function will return an empty ArrayList.
Before adding the generated string, just check if it has already been generated before to get the distinct permutations.
If you can generate the substrings of strings containing only distinct characters, then in this question, only modification will be to check whether the same substring has been generated before or not.
there must be editorial for this i think.
Hi ,
I wrote the following code acc to your guidance however my code only passes 2 out of all the test cases .
I am getting same permutations as well for AABA i am getting repetetive answers
Hi , I have again changed the code can you tell the issue with my code , is there a logic problem or there is a problem because lexographical order is not maintained https://ide.codingblocks.com/s/425473
@imsharan0105 your code is not checking with all the characters and there is a lot of duplicacy in your code.
moreover i am feeling it more confusing as well.
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.