How to find a word in file most time used ?

Q: How to find a word in file most time used ?
A: Keep words in a HashMap, everytime a new element found add that in map and increase their respective counter or if already available just increase the counter, return the max counter.


Any better solution welcome.....

No comments:

Post a Comment