ZS Associates Interview Question: Given a list of words, find t... | Glassdoor

Interview Question

Software Engineer Interview Chicago, IL

Given a list of words, find the word that appears most

  frequently.
Answer

Interview Answer

1 Answer

3

I chose to use a hashmap that contains the key (word) and value (# of times appeared). Scan through the list once to build up this hashmap. To find the maximum, you could dump the hashmap into an array and sort it. There are other things you could do too.

Interview Candidate on Dec 9, 2009

Add Answers or Comments

To comment on this, Sign In or Sign Up.