Facebook Interview Question: Read in text from a text file... | Glassdoor

Interview Question

Operations Engineer Interview Palo Alto, CA

Read in text from a text file or stdin and tally the most

  common words. Output, in order, the most common words present in the file.

Interview Answer

2 Answers


This isn't particularly a hard problem. They asked me to implement it in C++, but that was ultimately my choice, not theirs.

One word of caution. If you get an easy question like this, presume it's intended as a starter, and that they want you to finish it as soon as you can.

Interview Candidate on Jan 5, 2012

How did you do this ? It is not that straight forward in C++ considering an efficient solution would require using a hashmap and storing the words as key and their count as values. In the new standard you will have to use unordered map to accomplish this.

In python, this is way too easy. No wonder they wanted you to do it in C++.

Anonymous on Feb 20, 2012

Add Answers or Comments

To comment on this, Sign In or Sign Up.