You show up fifteen minutes early for your interview and wait calmly in the lobby. Plenty of time to center yourself and go over a few of the responses you have planned for certain interview questions. Hell, you’ve even got a response ready for the “Why are manhole covers round?” question and a plausible solution to the “Three Switches, One Light” puzzle. The interviewer finally arrives and takes you into a nearby office. The interview proceeds just like you’ve envisioned. You’re personable, confident, discerning, funny, and upbeat. You can almost see the rapport between you and the interviewer being built right in front your eyes.
Then it happens; the interviewer pulls out a seemingly blank sheet of paper and passes it over to you with a pen and says, “You have five minutes.” You read the short set of instructions and try to swallow your beating heart that suddenly has found its way into your throat back into your chest. You have been presented with the last thing you thought you would ever see during an interview for your ‘dream job’…
…the infamous FizzBuzz Challenge:
Write a program that prints the numbers from 1 to 100.
But, for multiples of three, print ‘Fizz’ instead of the number
and for multiples of five, print ‘Buzz’. For numbers which are
multiples of both three and five, print ‘FizzBuzz’.
Ahh, the time-honored interview question meant to separate the programmer-wheat from the programmer-chaff. As one site suggests “The ‘Fizz-Buzz Test’ is an interview question designed to help filter out the 99.5% of programming job candidates who can’t seem to program their way out of a wet paper bag.” Ahh, the time-honored interview screening device that you completely dismissed as being too trivial to even bother preparing for. But now, the heat is on, and you quickly realize that your ill-fated choice this cool winter’s morning to wear your ‘lucky’ necktie to the interview is only making matters worse.
Now, the proceeding scenario hasn’t happened to me personally. Nor do I ever anticipate it happening to me. Not that a potential employer wouldn’t ‘stoop’ to utilize FizzBuzz as a screening technique. It’s just that I don’t see myself ever applying for a strictly ‘programming’ position where such a filter might be implemented. I would hope that if I ever did, I would be able to easily implement a FizzBuzz solution without all the aforementioned stress and shock.
Earlier this semester at UH, the FizzBuzz Challenge was actually used in my Computational Physics mid-term. I would like to say I “easily implemented” a solution but, alas, I fumbled and choked being so easily thrown by being asked to use pseudocode instead of Python.
Here is my Python solution to the FizzBuzz Challenge: