what is meant by lexicographical order here? and give me a small hint on how to do this question without using set
Tricky permutations
Lexicographical means the order in which it appears in the dictionary.
For eg, the input is AAB.
AAB comes before ABA in dictionary so AAB should be printed first.
ABA comes before BAA, so ABA should be print before BAA.
And at last, BAA should be printed because it comes after both AAB and ABA.
You can create a custom compare function which helps to sort on the basis of dictionary order.
Hope this helps.
how can i avoid repetitions here without using set?
Store the permutations in sorted order in a vector. Repeated ones will be stored consecutively. You can avoid printing the repeated ones this way.
but that approach will take more time, is there any way to not produce the repeated strings again directly using recursion?
Yes, agreed, that this approach will take more time, but this is the only way to do without using the maps or sets.
Dont about the time in this question. This one is expected to be compiled in a long time.
okayyyyyyyy thankssss
Shall I mark the doubt as resolved?
dont worry ill mark it
can u look my other doubt pls