Requirements
You receive an array of words along with an array of queries. For every query, produce every entry from words that is an anagram of that query, with the returned entries arranged in lexicographic order.
get_search_results(words, queries)
Preparation
- First build the solution with a sorted-character-string key, then implement it again using a 26-integer frequency array converted into a string key so that individual words no longer need to be sorted.
- The familiar “Group Anagrams” problem is the standard example of this fingerprinting technique.