Can you help me in optimizing my code?
It shows a TLE for last test case. https://ide.codingblocks.com/s/441139
Please add comments which making changes
Can you help me in optimizing my code?
It shows a TLE for last test case. https://ide.codingblocks.com/s/441139
Please add comments which making changes
Instead of adding elements to the arraylist and then sorting it before printing.
convert the string to a char array. Sort the char array. And then just print the permutations. In this you will save a lot of computation. And the permutations will be sorted