Following was a question that was asked to me in one of the interviews. We know anagram of eat is: tea and ate The question is: We have a program. We feed a list of 10 thousand alphabets to this program. We run the program. Now at run-time, we provide a word to this program eg. "eat" Now the program should return the number of anagrams that exist in the list of 10 thousand alphabets. Hence for an input of "eat", it should return 2.
What will be the strategy to store those 10 thousand alphabets so that finding the number of anagrams becomes easy.