Interview Question

Aladdin & Technology Interview(Student Candidate) New York, NY

given a english dictionary, how will you store it to so

  that when you are given an input like "rat", you can fast output all the anagrams of the word "rat"(which are "art", "tar"and "rat")
Answer

Interview Answer

2 Answers

0

split the word into chars and store them in a hashset

Anonymous on Jun 9, 2014
0

hash map ,using <key,value> pair,with key sorted word, and values all the anagrams appeared.

Anonymous on Jun 9, 2014

Add Answers or Comments

To comment on this question, Sign In with Facebook or Sign Up