How can I take an input word (or sequence of letters) and output a word from a dictionary that contains exactly those letters?
Does java has an English dictionary class (list of words) that I can use, or are there open source implementations of this?
How can I optimize my code if this needs to be done repeatedly?
Convert your dictionary into an anagram dictionary. In an anagram dictionary, the words are indexed by their letters in sorted alphabetical order. To look up anagrams for a certain word, you sort its letters and look up corresponding ones from the anagram dictionary.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With