Having TLE issue in this question

how to resolve this with code

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