Microsoft Interview Question
Software Engineer in TestsWe can also use a hash map for the same. For each combination of the number, store it as a key and store all the associated words in the bucket in a link list. Whenever a user types those button, give the first of the words in the bucket as the o/p. If user inserts its own words then keep that word as the first one in the bucket.
I would keep the dictionary in a trie ... lookup the prefix in the trie for all three letters whenever a key is pressed ...
- Anonymous September 26, 2008