Hacker News new | past | comments | ask | show | jobs | submit login

Why do people say "doing fizzbuzz" rather than just programming? Fizzbuzz is just a trick question to see if new programmers know how to use the modulo operator or not.



I have been to student recruitment events at universities hiring software engineers for quite advanced level jobs. We give out a programming quiz (with a nice prize) at these events and we include the fizzbuzz puzzle. We allow solutions in any language and give out style points for nice solutions.

Our experience is that the answers to fizzbuzz are a good classification criteria in vetting who has got programming abilities and who has not. Most people who actually try can solve it, but the ones who are talented give out either a perfect and simple solution or do something elegant and go for the style points. The ones who don't give out a fumbling solution that is too long or shows signs of not being comfortable with the task at hand, even if they manage to write a computer program that produces the correct results.

As silly as it may sound, the fizzbuzz test is a good classifier for programmers. I didn't believe it until I saw the evidence from the quality of candidates we got.


Knowing how to fizzbuzz doesn't make you a good programmer.

But not being able to do it is a very strong signal that someone can't program in any professional setting, no matter what they pretend. It's a very simple and effective test to rule out people who think/pretend they can program, but really can't.


So... it's basically a bloom filter for developer aptitude? :)


Yes, yes it is.


You can solve fizbuzz without modulo operator:

    bool divisible_by(int a, int b) {
      return a==((a/b)*b);
    }
It doesn't require anything more than knowledge about what division means, and I think it's fair play to require such knowledge from programmers.


Maybe this is a stupid question, but wouldn't that always return true? (a/b)*b just cancels out the b right? Unless there is weird floating point stuff going on.


There's not floating point stuff going on, that's why it works. :)

a and b are ints, so a/b is truncated (rounded down) before applying *b.


It's integer maths. For example: a = 10, b = 3 10/3 = 3 3 * 3 = 9 9 != 10


Or even if you don't know anything about integer math, you can use repeated subtraction. Or ask for help on finding a multiple and do the rest of the structure yourself. Or keep a counter to 3 and a counter to 5 and reset them when they fill up.

Definitely not a gimmick question about whether you know about modulus.


Fizzbuzz isn't just modulo, as evidenced by the amusing number of incorrect solutions under the original article.


Fizzbuzz is a test for programming-ability. It's easy to explain, easy to grade, easy to run. If you wanna check if someone can programme, then someone else has already come up with a good test (fizzbuzz) to give them.


fizzbuzz I find is also used as slang for "Groks simple programming". I would say any fizzbuzz equivalent would be fine too.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: