How can I optimize my code as I got run error in 3 of cases.
Tricky permutations
@Codarikh Please dry run and verify your code. It is not giving any output even for the sample test case. Also increase the size of out[] array to 100000 and then check…as there may be more than 100 permutations possible for strings with length <8. So for that case your code will give run error.
one test case gives timelimit . plz resolve it.
Within the permute function, you are looping twice which indeed is time consuming and is causing time limit error for large test case. Try doing it with a single loop.
Refer this code for help.
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.