it shows TLE.how to get over this?
All test cases are passing except test case 0
Hey @J20APPPP0006
You need to use reference variable for string
Make line 7
void permute(string &str,int len,int i)
If your doubt is resolved please close it
but still its showing TLE.
@J20APPPP0006
Main issue was with you checking if string exists in store or not
I made your TC N^2 where N is str.length() factorial
I have optimised your code using set
You can see it here https://ide.codingblocks.com/s/223150
can you please tell about set as we have not used this previously .and dont know about this much that how automatically strings are getting printed in a sorted and unique manner
@J20APPPP0006 sure
So set is a data structure which stores elements in sorted order
It is a balanced Binary Search Tree
Insertion Deletion and Finding element works in O(logn)
It also keeps only a single copy of an element so it removes duplicates
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.