FizzBuzz: the Programmer's Stairway to Heaven

Being an almost graduated computer programmer coming across this article made me feel a lot better about my programming capabilities. Since i was able to figure out the solution to the fizzbuzz problem fairly easy i feel like i have a solid shot at making it into the pro’s(programmer’s get it lol). One thing i guess interviewees dont take into to consideration is the fact that programmers since they are always on a computer have easy access to google. To be able to search google when a simple syntax error is popping up or when a solution to a problem you are trying to solve has already been solved why not use it. No use to invent the wheel all over again. So to test someone using a basic program like fizzbuzz dosent really contend with the decision process that should be applied when hiring new candidates. To me its the programs people made that consider them a good programmer or not. Yes, not many people made programs that are on the market but any student who has taking computer science as their major has tons of programs to show off to potential employers. Also, if they are a computer science student who really wants to show their skills to the world they would be programming their own projects on the side just for knowledge of knowing how to program.

I can bang out fizzbuzz in 2-3 minutes in an interview situation, in multiple languages. I’ve done so multiple times. So why can’t I get past the interviews and actually get a job offer?

In Python, slightly optimized-

for i in range(1,100):
    p=i
    if (i%3==0 and i%5==0): p="fizzbuzz"
    else:
        if (i%3==0): p="fizz"
        else:
            if (i%5==0): p="buzz"
    print(p)

Lemme 1 up everyone wid a snippet in here…

http://tinyurl.com/6eomtmh

Skadoosh (O.O) \m/

Hey I solve the problem under 5 min her is my code in python

for x in xrange(1,101):

if (x%3 == 0):

	print "Fizz"

elif (x%5 == 0):

	print "Buzz" 
elif (x%3 == 0 and x%5 == 0 ):

	print "FizzBuzz"

else: 

	print x

I know developers who would absolutely think the second is “better” than the first. However, they’d really prefer that the string constant be read from a database “CONSTANTS” table so that the value is kept separate from the code in such a way that it reduces coupling in the object space so as to etc blah etc blah.

Unfortunately, on occasion I have to maintain their code. Pray for me… :frowning:

2 Likes