Interview Question

Senior Systems Software Engineer Interview San Jose, CA

Find the words used in some text and report by word length

  and how often each word appears.
Tags:
data structures, collections
Answer

Interview Answer

1 Answer

1

Parse list to obtain words, whether space/comma/linebreak delimiter

ArrayList<HashMap<String,Integer>> where the word length will be the index of the ArrayList.

HashMap<String, Integer> will have key as the single word in text and the value will be an Integer as the counter for how many times the word appears.

Lenovs on Feb 9, 2011

Add Answers or Comments

To comment on this, Sign In or Sign Up.