FizzBuzz is an example of an interview question where the challenger is given a trivial problem with the objective to belt out a complete program.
Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.
Most good programmers should be able to write out on paper a program which does this in a under a couple of minutes.
Want to know something scary ? - the majority of comp sci graduates can’t. I’ve also seen self-proclaimed senior programmers take more than 10-15 minutes to write a solution.
Something scarier for me personally is that it took me 5 minutes to do it. I don't know just who would be able to finish in 2 minutes. It looks like they are measuring the speed with which a person can write on paper instead of programming ability.
If they start asking this shit at interviews, my only hope is real estate or insurance.
P.S. English kids who play this game in kindergarten are freaking geniuses. The only sensible plan seems to be to keep two counters, which is actually quite challenging. I saw mental excersises like that, given in all seriouseness. For example, you read a long string of icons and count the number of ducks and airplanes in it, separately. Virtually nobody can keep track of 4 items together. The alternative for the kids is to sum numbers for a division by 3 really quickly. I don't know if kids are up to it.
UPDATE: Yenya wrote "Pete mentions that even some comp.sci graduates cannot solve this problem." I don't think it was I. The original article did.
UPDATE in 2019: Holy mother of God, you just look at this lack of self-awareness:
Interviewer: Are you familiar with FizzBuzz?
Me: Um, to be honest, no.
Interviewer: Ok, well, you have to write a program where multiples of three print 'Fizz' instead of the number and for the multiples of five print 'Buzz'. For numbers which are multiples of both three and five print 'FizzBuzz'. So it would look like '1, 2, Fizz, 4, Buzz, Fizz, 7, 8, Fizz, Buzz, 11, Fizz, 13, 14, Fizz Buzz'
Me: (OMG MATH. I tried to talk through it a bit, but then said:)
Me: Ok, again to be honest, my JS knowledge is more regarding UI/UX based tasks. And I don't really understand the point of the question. Like, what's the use case? When would this come up in the role?
(Only after recounting this interaction to a friend did I realize you should not ask "why are you asking me this?" in a job interview.)
Interviewer: Well, it's an exercise in programmatic thinking. No worries, let's move on to the next question. Write a function that takes a timecode string and turns it into seconds.
Again I started talking through it, but it was impossible for me to figure it out with someone watching. I needed to do some serious Googling. He said I could email back my solutions. I toyed with the idea of calling up and saying, "forget it, this isn't for me" but I decided to stick it out. After spending a few hours coming up with something that semi-worked, I found the solution on StackOverflow and, in my honesty, linked to it in the code.
Unsurprisingly, a few days after I sent my solutions I got a "you don't have enough experience for the position, but we'd like to keep your resume on file". In my impostor-prone state, I felt called out as a just-good-at-Googling-and-maybe-jQuery developer. I was embarrassed.
Wow. So, the FizzBuzz really is an indicator, even at this level.
(h/t a tread about hiring in Malaysia)