After getting suitable combination rather than to store them and sort separately,is there any another way to sort?
Logic Issue in Sorting
According to the test cases set, the output must be in sorted order. So you will have to store all the permutations in a vector/array and then finally sort it to get the result. Another way could be that you can push the permutations being generated in the recursive function to a Stl set. Elements remain sorted in the set.
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.