by msg · 16y ago · 0 comments
I prefer asking for a program that will take about an hour, but will also get a range of correct answers and mistakes. The ideal question has maximum dispersion, like a good hash function. You can observe a variety of strengths and weaknesses, and the horrible candidates will cry, the mediocre candidates will cringe, the good candidates will nod, and the strong candidates will laugh.
So there's file I/O, string matching, string storage, counting probably means a simple data structure, and there's formatted output to print the number of occurrences.
You can also ask deeper questions, such as the big-O of the algorithm/data structure they come up with, and what happens if the file is too large to load in main memory.
Perl programmers (for example) will laugh at this question, but in my experience that puts them ahead of the rest of the interviewing pack.
I ask a similar question in my interviews that has some simple math instead of strings.
I don't demand that my interviewees can remember the name of every library function, but if there's too much handwaving I get suspicious.