Hacker News new | comments | show | ask | jobs | submit login
Ask HN: Why is it that so many people fail fizzbuzz?
12 points by ruswick 1404 days ago | hide | past | web | 19 comments | favorite

I am a awful interviewee. Absolutely awful.

I routinely bomb the simplest interview quizzes. Usually the early "weed-out" ones like FizzBuzz. I do fine on the much more advanced questions.

I think part of what makes them more difficult for me is that they feel like a test. The more advanced questions, they feel like engineering problems in need of a solution. But when someone pops up with an out-of-nowhere "do this purpose-less thing!" question, I spend all of my time wondering about what they're actually looking for, and none thinking about the problem at hand. Is this a trick? Am I missing something? What does he want from me!?

I also just can't code worth a damn when someone is staring at me. I love interviewers who pose a long, complicated question and then leave the room for 30 minutes so I can work on it. These are always much more difficult problems, and I find them infinitely easier than the little 2-minute quizzes.

It's what I call "screening" failure. The wrong person was brought into the interview for the wrong position. When somebody fails fizzbuzz, this is 100% the fault of the hiring company/recruiter. Fizzbuzz is not a test, it's a "Lets get comfortable before the interview starts in earnest" type question. If you are a proficient developer, and you aren't able to nail that in your sleep, then somebody made a huge mistake bringing you in for an interview.

Our company has recently started doing (developer) screening by doing online real time coding, where the candidate get the opportunity to solve some real-time problems in their vertical, with whatever tools/compilers they are comfortable with (Java/Python/C/C++ and MAC Layer, PHY Layer, SQL, UI Frameworks, etc..) before they are brought in for an interview.

Nobody fails fizzbuzz in our interviews, and it means nobody is wasting interviewing time doing screening anymore.

I wonder if its because the modulus operator (the obvious way to solve it) isn't something you use all the time for basic CRUD applications?

As an example i'm working on a largish codebase (100,000 lines) right now now and a quick grep shows only 4 uses of it, all of which are in a jQuery plugin.

My new interview-screening question will be "solve fizzbuzz without using division or modulus". Because it's still so easy that you don't want to hire anyone who can't do it.

Simple Perl Code

  my $i;
  my $fizz = 3;
  my $buzz = 5;
  for ($i = 1; $i <= 100; $i++) {
    if ($i ne $fizz && $i ne $buzz) {
      print "$i\n";
    if ($i eq $fizz) {
      print "fizz";
      $fizz += 3;
    if ($i eq $buzz) {
      print "buzz";
      $buzz += 5;
    print "\n";
Edit for formatting

or in stupidly terse Ruby... f,b=3,5;(1..100).each{|i|s='';(s,f='Fizz',3)if(f-=1)==0;(s,b=s+'Buzz',5)if(b-=1)==0;puts(s==''?i:s)}

As a primarily CRUD developer, I use mod all the time. Primarily for zebra striping in browsers that don't support :even or related CSS.

I hadn't even thought of using a css based answer to fizzbuzz, but I guess it is possible now.

Is there a non-mathematical version of the FizzBuzz test?

I just googled around for that, and here's a brutish one in Ruby: https://gist.github.com/3230825

And because I had to fiddle around manually to understand it (not good at Ruby's inbuilt methods) here's how it works: It generates two long arrays, one containing "Fizz" every third element, and one containing "Buzz" every five elements, the rest is filled up with nils.

Then it iterates over 1 to 100 and zips the two arrays at that position together - if the "zipped together" sum of both arrays is nil, that number is printed, else the concatenated string of both arrays at that position is printed (example: "Fizz" + nil = "Fizz"). Neat!

Edit: I also found a great one using flip-flops: https://gist.github.com/3230984

That is actually a rather clever solution. I guess you could do the same in Python, using itertools.

That said, I guess I should rephrase my question: Is there a simple programming test that can help weed out fakers quickly, which does not involve mathematics? Sort of like "Deploy a simple CRUD app in 15 mins" or something?

This is to address the parent's concern that a lot of web apps out there don't actually require much mathematics.

For completion's sake, yes you can do that in Python, it's just slightly uglier (as far as I know) using

''.join(filter(None, [a, b]))


itertools.cycle([None, None, 'Fizz'])

itertools.cycle([None, None, None, None, 'Buzz'])

I did a coding interview problem once where the company gave me an API endpoint that spat out JSON representing products, and told me to build a page that displays those objects onto a page with infinite scroll. As you scrolled down to the bottom of the page it would load more products.

My postulate is that there are some people who have really really really good soft skills, and they get through the interview by wit and charm alone. The interviewer decides to hire the person before it gets the the fizzbuzz part. Those people get by on the job by taking a really long time to get things done, but have great excuse masking skills, so they keep their job. This is all based on my experiences working with people who couldn't do fizzbuzz. The one things that they all had in common, was that they all had really great people skills.

Note: Thats not to say that that all people with people skills can't do fizzbuzz, just the people with an abundance of it. Why waste time getting good at a hard skill, if you can get by perfectly fine with your great soft skills?

It's a failure to understand skill. People who have not done something don't understand that skill matters. Look at any skilled trade. Everyone thinks they can cook as well as a head chef with just a few months practice and a cookbook, but the head chef will beat them because those years matter. Even when thing seem equal, skill still matters. If you give two top experts the same task, one may have specialized skill in the task. This specialized skill not only let's on expert complete the task, it may totally prevent the other expert from completing the task altogether. To they lay person, the reaction is "I don't understand. they are both experts.". Skill matters more than people understand.

I had to lookup fizzbuzz as I wasn't familiar with it. I haven't interviewed in 10 years. At first I thought there must be a trick, it's too simple. Way simpler than the tests I've given interviewing (reversing a string). But it is as simple as it sounds.

It's a shame people can't get it. But modulus is an operation I do daily.

My question is, what do these people think they are going to do when they get the job? Or do they actually think they can program, and then realize that they can't?

I've worked with people who could program in the sense that they knew their language API and knew how to string libraries together in an obvious manner in a way that made the program at least compile. However they where completely lost when they actually had to come up with their own solution to something. If asked to solve FizzBuzz their first step would be to check if the standard library came with a FizzBuzz function, then they'd look around for a third party FizzBuzz library, then they'd use Google to try to find some code on a forum they can blindly copy and paste, and if all that fails they'll make up some excuse as to why they can't work on FizzBuzz right now and hand it off to someone else.

The thing is you can get quite far in programming using that approach.

wait, is fizzbuzz really that wide spread as testing technique ?

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact