Given a book find out the number of times each word appeared .....
Software QA/Tests Interview Questions from Microsoft
(Continued from previous question...)
Given a book find out the number of times each word appeared .....
Question:
Given a book find out the number of times each word appeared. Upon clarification I was told the following things 1. punctuations should be removed 2. case sensitive 3. assume book is given as a huge string to the function prototype 4. Words need not be ordered in any way
maybe an answer:
split the string into array of words, sort the array alphabatically and go through it. Whenever word n is equal to word n+1 increase the number of times its repeated.
(Continued on next question...)
Other Interview Questions
