Which is the best way of generating anagrams for a text(maximum 80 characters length). Example: Input: dog output dog dgo odg ogd gdo god
I'm only thinking of a backtracking solution, but that will take a while if the text is longer.
Another thought is bulding i trie for all words in dictionary, but the problem doesn't ask for real words.
Can somebody point out a minimum time complexity solution?
Thank you!