Hacker News new | ask | show | jobs
by johnnyb9 1557 days ago
Just curious, has anyone ever had a candidate actually fail FizzBuzz in front of them? I think the original statement was something like 90% of candidates can't do it. In my experience, every single candidate I have ever given that question succeeds. When I am asked FizzBuzz on an interview, I am actually insulted.
2 comments

Not FizzBuzz, and not me personally, but from someone I worked with and I have 0 reason to believe is lying:

After a few disappointing responses to better questions, interviewer decides to give a "freebie" and asks for a function that determines whether an integer is odd or even.

Candidate produces something that loops from 0 to the provided integer, incrementing two separate counters, then comparing them at the end.

Interviewer manages to stammer out something like "are you sure there isn't a more efficient way to solve this?"

Guy furrows his brow for a few minutes more, then a light bulb of sorts goes on, and he declares "Of course! ..."

"... I only need one counter!"

That seems more like a failure of mathematical reasoning than in programming.
I would be amazed to meet someone who, if asked whether 3042041 was odd or even, would follow this exponential-time procedure manually. Unless the candidate was such a person, it's a failure of programming.
They just seem numerically illiterate to the point of not realizing how to determine odds or evens.

Though perhaps, if they were more competent as a programmer, they would skip decimal math altogether and use the ol' bitwise operator trick.

FWIW, gcc 10 generates identical code for `i % 2 != 0` and `i & 1 != 0` at -O1.
Yeah, but "doesn't know about the % operator" is a lot less damning than "can only think of an exponential-time algorithm to determine if a number is even". Like, this is terrible, but it's linear time:

    char s[32];
    sprintf(s, "%d", n);
    char c = s[strlen(s) - 1];
    return c == '0' || c == '2' || c == '4' || c == '6' || c == '8';
Not fizzbuzz, but at one of my past companies we did a similar low complexity problem (use any language you fancy, google if you need to, you get a list of things, filter them by some attribute and group it by another, print out the list per group) during a phone screen, and people did fail it. Typically doesn't happen in later interviews, unless people have a complete mental breakdown due to stress.