

On Hiring and FizzBuzz - scrabble
http://topherlandry.wordpress.com/2014/08/31/on-hiring-and-fizzbuzz/

======
thebear
I honestly don't know if it's the mathematician in me, or if I'm just a cranky
person, or if I actually have a valid point, but if I were given the FizzBuzz
task the way it is worded here, I would reject it on the grounds that it is
self-contradictory:

'for multiples of three print “Fizz” instead of the number [...]. For numbers
which are multiples of both three and five print “FizzBuzz”'

So for the number 15, for example, I am being asked to print "Fizz" instead of
the number, but I am also asked to print "FizzBuzz". That cannot be done. A
valid way of formulating the problem would be:

Write a program that prints the numbers from 1 to 100. But for multiples of
three _that are not multiples of five_ print “Fizz” instead of the number, and
for multiples of five _that are not multiples of three_ print “Buzz” instead
of the number. For numbers which are multiples of both three and five print
“FizzBuzz” instead of the number.

An alternate way of saying it would be:

Write a program that prints the numbers from 1 to 100, except for numbers that
are multiples of three or five. For multiples of three print “Fizz”. For
multiples of five print “Buzz”.

(Edit: no, the above doesn't work, because it would allow you to print
"BuzzFizz" for numbers like 15. You'd still have to add, 'For numbers which
are multiples of both three and five, print “FizzBuzz”.' So it's really just
the clause "instead of the number" in the original formulation that causes the
contradiction.)

~~~
mcv
It's still a good test. I wouldn't hire you if you insist on making a problem
out of something you understand perfectly well.

------
chrisbennet
I'm in the camp who thinks that fizzbuzz is a "do you know the modulus
operator?" test.

I use the modulus operator several times a week but I realize that the
software world is a pretty big place and people do _not_ all know the same
things that I do because they don't have any reason to.

For example: I never have cause to use a hash table. It's not something
applicable to the stuff I work on. A world where hash tables aren't useful is
probably unimaginable to some of you. I can assure you, I'm not an idiot - my
mother had me tested ;-) I just work in a different corner of the programming
space than the mainstream developer.

------
raymondh
FWIW, Trello's FizzBuzz has more meat to it than this article suggests :-)

~~~
scrabble
It really is an excellent FizzBuzz, and I feel like it gets to the root of
what FizzBuzz should be accomplishing -- does someone understand basic
programming constructs like loops, and are they able to analyze and solve the
problem?

The people that I've shown it to in person tend to overthink it on first go,
going so far as to talk about rainbow tables to solve the hash. In fact, if
you spend the time to look at the hashing algorithm itself it's much easier
(and is also a terrible "hash.")

------
mcv
You can even implement FizzBuzz without being aware of the modulo operator.
It's not that hard to write your own test that does the same thing.

~~~
JoeAltmaier
Sure you could have two counters, one initialized to 3 and one to 5, that are
decremented each time thru the loop. When they reach zero print Fizz or Buzz
and reinitialize.

Or you could create a finite list, initialize each member to its index, then
go through by 3's and 5's and replace a number with Fizz or Buzz, or if not a
number just add it.

Or you could create a program that generates print statements that print the
same, then run that.

Or you could write a scraper that searches the web for 'fizzbuzz solution' and
print the text on that page.

Or...

~~~
mcv
Or you take the number, divide it by 3, round down, multiply by 3, and if it's
the same as the original, you print Fizz. Same effect as the modulo operator,
but without the modulo operator.

