FizzBuzz and bored programmers
On his blog, tickletux advocates the use of FizzBuzz to find developers who grok coding. However, this kind of test may also cause difficulties. What do you do if a candidate answers with the following (correct) C code?
#include <stdio.h>
static const char *t[] = {"%d\n", "Fizz\n", "Buzz\n", "FizzBuzz\n"};
int main()
{
unsigned int i;
for(i = 1; i <= 100; i++) printf(t[3&19142723>>2*i%30], i);
return 0;
}
What explanation would you choose?
- the candidate is smart and managed to avoid any explicit test (“branches are evil” philosophy): hired;
- the candidate tried to impress you and won’t explain the 19142723 in her code: she is likely to cause problems in the team: not hired;
- the candidate mind is so convoluted that she could not think of another solution: not hired
- the problem you gave the candidate was so boring that she solved it while having some fun; may be a real problem solver: hired;
- the candidate is perfectly suited for an embedded systems programmer position: hired or not, depending on the kind of software you want her to write.
If I were to interview people for a programmer position, I honestly don’t know what I would do with someone writing such a code in response to the original problem. I would probably assume that the programmer was bored and that she wanted to have some fun while doing her job, and I kinda like this idea.
blog comments powered by Disqus