Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

fizzbuzz

Name: Anonymous 2009-12-04 0:39

On occasion you meet a developer who seems like a solid programmer. They know their theory, they know their language. They can have a reasonable conversation about programming. But once it comes down to actually producing code they just don’t seem to be able to do it well.

You would probably think they’re a good developer if you’ld never seen them code. This is why you have to ask people to write code for you if you really want to see how good they are. It doesn’t matter if their CV looks great or they talk a great talk. If they can’t write code well you probably don’t want them on your team.

After a fair bit of trial and error I’ve come to discover that people who struggle to code don’t just struggle on big problems, or even smallish problems (i.e. write a implementation of a linked list). They struggle with tiny problems.

So I set out to develop questions that can identify this kind of developer and came up with a class of questions I call “FizzBuzz Questions” named after a game children often play (or are made to play) in schools in the UK.

In this game a group of children sit around in a group and say each number in sequence, except if the number is a multiple of three (in which case they say “Fizz”) or five (when they say “Buzz”). If a number is a multiple of both three and five they have to say “Fizz-Buzz”.

An example of a Fizz-Buzz question is the following:

[quote]Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.[/quote]

Most good programmers should be able to write out on paper a program which does this in a under a couple of minutes.

Want to know something scary ? – the majority of comp sci graduates can’t. I’ve also seen self-proclaimed senior programmers take more than 10-15 minutes to write a solution.

I’m not saying these people can’t write good code, but to do so they’ll take a lot longer to ship it. And in a business environment that’s exactly what you don’t want.

This sort of question won’t identify great programmers, but it will identify the weak ones. And that’s definitely a step in the right direction.

Name: Anonymous 2009-12-10 10:20

I just saw the gay fi ligature in the thread title.

Name: Anonymous 2009-12-10 10:28

>>121
Wanna fight about it?

Name: Anonymous 2009-12-10 10:29

>>122
I don't see anything to fight about.

Name: Anonymous 2009-12-10 12:03

>>122
+8 Susspoints for paying attention to the details.

That reminds me, where did 1 go?

Name: 121-kun 2009-12-10 13:09

>>124
Excuse me, >>122-san seems to have gotten my eight Susspoints.

Name: Anonymous 2009-12-10 13:32

I have OVER 1MILLION Susspoints in my offshore Sussbank Sussaccount

Name: Anonymous 2009-12-10 13:32

What do you mean? >>122-kun was supposed to get them. And this post of yours shows clearly that the prize should indeed be subtracted from your account.

Name: Anonymous 2009-12-10 13:53

hax my anus

Name: Anonymous 2009-12-10 14:18

>>128
i love ur retro-style

Name: Anonymous 2009-12-11 18:43

>>122
I don't see any ligature. It's fi (U+0066 U+0069), not (U+FB01).

Name: Anonymous 2009-12-11 21:22

>>37
How does a cudder look?

Name: Anonymous 2009-12-11 21:40

ᶠᶦᶻᶻᵇᵕᶼᶼᶠᶦᶻᶻᵇᵕᶼᶼᶠᶦᶻᶻᵇᵕᶼᶼ

Name: Anonymous 2009-12-11 21:49

ᶠᶦᶻᶻᵇᵕᶼᶼ

Name: Anonymous 2009-12-12 0:02

Buzz my anus

Name: Anonymous 2009-12-29 2:39

:0 j0 + j1 %$0,3 =0 [ p"Fizz" ] j2 %$0,5 =0 [ p"Buzz" g1 ] j1 !0 [ g2 ] :1 j0 =100 [ g99 ] p"\n" g0 :2 j2 !0 [ p$0 g1 ] :99


Expert programming language.

Name: Anonymous 2009-12-29 4:33

1+1+1+1+1+1+1+1+1+1+1+1= _____________




























http://www.cafepress.com/digitalnasties

Name: Anonymous 2009-12-29 7:36

I managed to do it in 5 minutes in Java, not my best code ever and I'm only a 1st year student of computer sciences. My code:

public class FizzBuzz
{
   public static void main(String[] args)
     {
    for (int i = 1; i <= 100; ++i)
      {
         if (i % 3 == 0 && i % 5 == 0)
           {
          System.out.println("FizzBuzz");
           }
         else if (i % 3 == 0)
           {
          System.out.println("Fizz");
           }
         else if (i % 5 == 0)
           {
          System.out.println("Buzz");
           }
         else
           {
          System.out.println(i);
           }
      }
     }
}

Name: Anonymous 2009-12-29 8:23

#include <iostream>
using namespace std;

int divideByThree(int x);
int divideByFive(int x);

int main() {
    int haxus = 1;
    for (haxus; haxus <= 100; haxus++) {
        if (divideByThree(haxus) == 0 && divideByFive(haxus) != 0) {
             cout << "Fizz\n";
             }
        else if (divideByThree(haxus) != 0 && divideByFive(haxus) == 0) {
             cout << "Buzz\n";
             }
        else if (divideByThree(haxus) == 0 && divideByFive(haxus) == 0) {
             cout << "FizzBuzz\n";
             }
        else {
             cout << haxus << "\n";
             }
        }
    return 0;
}

int divideByThree(int x) {
    return x % 3;
}

int divideByFive(int x) {
    return x % 5;
}

Name: Anonymous 2009-12-29 8:27

>>138
(≖‿≖ )

Name: Anonymous 2009-12-30 0:42

/* 12:38:53 AM */


int main() {
   
    int i;
    for (i = 1; i<=100; i++) {
       
        if (!(i%15))
            printf("JizzFizz\n");
        else if (!(i%3))
            printf("Jizz\n");
        else if (!(i%5))
            printf("Fizz\n");
        else
            printf("%d\n", i);
       
       
    }
   
   
}

/* 12:41:22 AM */

Name: Anonymous 2009-12-30 7:55

/* 14:54:01 */

>>140
You're implementation sucks.

/* 14:54:12 */

Name: Anonymous 2009-12-30 11:02

/* 11:02:26 AM */

You're grammar sucks.

/* 11:02:35 AM */

Name: Anonymous 2009-12-30 14:40

hey guys im sweden

-module(fb).
-export([fb/0]).

fb() -> fibu(100).

fibu(1) -> 1;
fibu(N) when (N rem 3) == 0, (N rem 5) == 0  -> io:format("Fizz-Buzz~n",[]),
                                                fibu(N-1);
fibu(N) when (N rem 3) == 0                  -> io:format("Fizz~n",[]),
                                                fibu(N-1);
fibu(N) when (N rem 5) == 0                  -> io:format("Buzz~n",[]),
                                                fibu(N-1);
fibu(N)                                      -> io:format("~w~n",[N]),
                                                fibu(N-1).

Name: Anonymous 2009-12-30 23:25

(define fizzbuzz
  (λ(ceiling)
    (let ((fb (list 'n 'n 'fizz 'n 'buzz 'fizz 'n 'n 'fizz 'buzz 'n 'fizz 'n 'n 'fizzbuzz)))
      (let L ((cycle fb)
              (n 1))
        (if (= ceiling n)
            empty
            (let ((cycle (if (empty? cycle) fb cycle)))
              (let ((val (if (eq? 'n (car cycle)) n (car cycle))))
                (cons val (L (cdr cycle) (+ 1 n))))))))))

Name: Anonymous 2009-12-31 0:10

>>144
I rate your post -1 because it uses a capital letter in scheme. Disgusting. NO CAPITAL LETTERS!

Name: Anonymous 2009-12-31 0:13

99.9% of Computer Science papers are descriptions of efficient algorithms/data structures that are impractical to implement.

Name: Anonymous 2009-12-31 8:47

>They know their theory, they know their language.
It is better if they know mathematics and algorithmics. After, the language is less important.

Here some poeple check that x is divisible by 3 and is divisible by 5. It is faster to check that x is divible by 15.

Name: Anonymous 2009-12-31 8:48

CHECK MY ANUS

Name: Anonymous 2009-12-31 12:42

>>145
Thank you for your constructive criticism, I will work on it!!

Name: Anonymous 2009-12-31 13:32

>>147
Don't help them!!

Name: Anonymous 2010-01-04 5:01


#include <stdlib.h>
int main(){char*f="Fizz",*b="Buzz",i;for(i=0;i<101;i++)printf((i%3)?((i%5)?"%3$d\n":"%2$s\n"):((i%5)?"%s\n":"%s%s\n"),f,b,i);}

Name: Anonymous 2010-01-04 5:18

>>151

#include <stdlib.h>
int main(){char*f="Fizz",*b="Buzz",i;for(i=0;i<101;i++)printf(i%3?i%5?"%3$d\n":"%2$s\n":i%5?"%s\n":"%s%s\n",f,b,i);}

Name: Anonymous 2010-01-04 5:33

>>152

#include <stdlib.h>
int main(){char*f="Fizz",*b="Buzz\n",i;for(i=0;++i<101;)printf(i%3?i%5?"%3$d\n":b:i%5?"%s\n":"%s%s",f,b,i);}

Name: Anonymous 2010-01-04 7:24

>>153
i;main(){while(i++<100)printf("%s%s%.d\n",i%3?"":"Fizz",i%5?"":"Buzz",i%5&&i%3?i:0);}

Name: Anonymous 2010-01-04 8:42

>>154
#include <stdlib.h>
i;main(){while(i++<100)printf("%s%s%.d\n",i%3?"":"Fizz",i%5?"":"Buzz",i%15?i:0);}

Name: Anonymous 2010-01-04 10:02

>>155
#include <sys/mman.h>
main(){facepalm();}

Name: Anonymous 2010-01-04 11:21

int main(){return -1;}

Name: Anonymous 2010-01-04 12:08

i%3?"":"Fizz",i%5?"":"Buzz",i%15?i:0)
"1
"2
"Fizz3
"4
"Buzz5"
I might be misinterpreting the printf (I've always been bad about that) but this is not what the instructions ask.

Name: Anonymous 2010-01-04 14:41

MISINTERPRET MY ANUS

Name: Anonymous 2010-01-04 15:47

#include <fizzbuzz.c>

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List