5 ms·
I think a lot of people who complain don't realize that a decent amount of people do fail FizzBuzz. If they are as smart as they think they are, then they woul
by jakejake 13y ago
I think a lot of people who complain don't realize that a decent amount of people do fail FizzBuzz. If they are as smart as they think they are, then they would definitely appreciate not having people on their team who cannot complete FizzBuzz!
I have asked this question before and a lot of people don't know the mod operator and so they struggle and eventually it occurs to them to divide and check the remainder. This usually leads to kinda sloppy looking code, but, I find it to be very revealing about their problem solving abilities. Some people just give up. Some people ask for help. Some people get angry or flustered. All of these scenarios are extremely revealing and help you to understand the candidate's approach to problems.
When the candidate already knows FizzBuzz then the results are usually less interesting - but sometimes they may solve it is some really unusual way which is cool to see.
- gamegoblin 13y agoI always suspected that anyone who fails fizzbuzz does it because they are unfamiliar with divisibility mathematics. I am always amazed at CS students who have no grasp on relatively simple math. I remember trying to explain binary addition to people in a circuits class when we were implementing ripple-carry adders. I was explaining how binary addition is the exact same as decimal addition except you carry at 2 rather than 10. The guy I was explaining it to asked "What is carrying?". He hadn't done addition by hand in so long he had entirely forgotten. And this is a guy who can code up a functional, decent looking PHP based website in a matter of minutes. I suppose it's even more believable that people would forget long division, remainders, and modulus.
- AndrewDucker 13y agoWhen I interviewed for a coding job about 15 years ago I was asked to talk the interviewer through some code. Nothing very exciting, just a very basic loop. It turned out that 3/4 of the people applying for the job _could not code at all_. They weren't just bad coders - they had never coded anything in their lives. It's _those_ people that FizzBuzz catches out.
- jakejake 13y agoI find that to be exactly true. The really surprising thing is that a college degree or experience at a big company doesn't necessarily tell you what you can learn from just walking through some very basic code.
- gamegoblin 13y agoYou said it was cool to see unusual FizzBuzz solutions, so I just coded this up in the last 10 minutes. So... FizzBuzz without any modulo or division operations! #include <stdio.h> int f0(unsigned int x) { return x? (x&(1<<31)? f1(x<<1) : f0(x<<1)) : 1; } int f1(unsigned int x) { return x? (x&(1<<31)? f3(x<<1) : f2(x<<1)) : 0; } int f2(unsigned int x) { return x? (x&(1<<31)? f0(x<<1) : f4(x<<1)) : 0; } int f3(unsigned int x) { return x? (x&(1<<31)? f2(x<<1) : f1(x<<1)) : 0; } int f4(unsigned int x) { return x? (x&(1<<31)? f4(x<<1) : f3(x<<1)) : 0; } int t0(unsigned int x) { return x? (x&(1<<31)? t1(x<<1) : t0(x<<1)) : 1; } int t1(unsigned int x) { return x? (x&(1<<31)? t0(x<<1) : t2(x<<1)) : 0; } int t2(unsigned int x) { return x? (x&(1<<31)? t2(x<<1) : t1(x<<1)) : 0; } void main() { unsigned int i; for(i=1; i <= 100; i++) { if(t0(i)) printf("Fizz"); if(f0(i)) printf("Buzz"); if(!(t0(i)|f0(i))) printf("%u",i); printf("\n"); } }
- deleted 13y ago[deleted]
- jakejake 13y agofantastic! I would be rightfully impressed and amused!