You have _ minutes to solve the most famous programming interview question in your favourite language:
>Print the numbers 1 to 100 >Next to every multiple of 3, print Fizz >Next to every multiple of 5, print Buzz >Next to every multiple of 3 and 5, print Fizz Buzz
A for loop would have been a little nicer, but a functional fizzbuzz for 1 to 49. Fuck I didn't read the OP and see that you had to print each number
Logan Baker
done again in a loop. class FizzBuzz{ public static void main(String[] args){ for(int i =1; i
Asher Hall
npm install --save fizzbuzz-solver
var fizzbuzz = require('fizzbuzz-solver')
fizbuzz(0, 100);
I just started coding in node.js a couple of weeks ago and spent like 15 minutes searching for the right module with the least amount of bloat i think it works alright
Daniel Myers
I'm still trying to figure out how functions and loops work but I am excited for the day I can do fizzbuzz.
Colton Richardson
>b-b-but I'm a web designer, not a math professor!
Trying to learn vim so I did another in Python3 for i in range(100): print(i, end = " "); if(i%3==0): print("Fizz", end = " "); if(i%5==0): print("Buzz", end = " "); print("\n");
Mason Bennett
u realize all ur answers are fucked?
ur supposed to print Fizz on 3 not 3Fizz
Matthew Watson
Read the OP again. Thanks for coming along to the interview, you'll hear back from us if you've been successful.
Nolan Green
if you don't know 'fizzbuzz' by heart and fall for the trap then you have no chance, idiot
Kevin Torres
>Print the numbers 1 to 100 >Next to every multiple of 3, print Fizz The idiot is you, and the trap is not reading the question.
Ryder Carter
>solve the most famous programming interview question says that BEFORE the trap description get rekt
int main LEFT_PARENTHESIS RIGHT_PARENTHESIS LEFT_BRACE int i SEMICOLON for LEFT_PARENTHESIS i EQUALS 0 SEMICOLON i IS_LESS_THAN_OR_EQUAL_TO 100 SEMICOLON i INCREMENT RIGHT_PARENTHESIS LEFT_BRACE if LEFT_PARENTHESIS i MODULUS 3 IS_NOT_EQUAL_TO 0 AND i MODULUS 5 IS_NOT_EQUAL_TO 0 RIGHT_PARENTHESIS printf LEFT_PARENTHESIS "%d" COMMA i RIGHT_PARENTHESIS SEMICOLON if LEFT_PARENTHESIS i MODULUS 3 IS_EQUAL_TO 0 RIGHT_PARENTHESIS printf LEFT_PARENTHESIS "Fizz" RIGHT_PARENTHESIS SEMICOLON if LEFT_PARENTHESIS i MODULUS 5 IS_EQUAL_TO 0 RIGHT_PARENTHESIS printf LEFT_PARENTHESIS "Buzz" RIGHT_PARENTHESIS SEMICOLON
>invert a binary tree >where do you see yourself in 5 years >what can you contribute to our company >fizzbuzz, then fizzbuzz without modulo >would you pull the lever of the trolley problem >write a program that prints out the password to your facebook account backwards >the user X killed himself under mysterious circumstances: what do you do with the leftover data
> I have seen many comments here that are unnecessarily harsh or rude. Rudeness adds nothing constructive to the conversation so I’m perfectly okay with seeing rude, harsh or nonconstructive comments removed. > There are some people writing that if you can’t “FizzBuzz” you don’t belong in this industry. That’s a harsh thing to say and it’s simply not true.
Gets me every time.
Carson Anderson
>fizzbuzz without modulo Why?
Christopher Gutierrez
> There are some people writing that if you can’t “FizzBuzz” you don’t belong in this industry. That’s a harsh thing to say and it’s simply not true.
If you can't write a FizzBuzz you're basically mentally challenged
Anthony Reed
Why not? #include
int main() { size_t f = 0, b = 0, to = 20; for (size_t i = 1; i 2 ? 0 : f) == 2; int bt = (b = b > 4 ? 0 : b) == 4; printf("%s", ft ? "Fizz" : ""); printf("%s", bt ? "Buzz" : ""); printf(ft || bt ? "\n" : "%zu\n", i); } }
Camden Robinson
to prove you didn't only memorize the first google result and/or can think up multiple ways to solve the problem
Andrew Campbell
for i in range(1,101): fb = '' if i % 3 == 0: fb += 'Fizz' if i % 5 == 0: fb += 'Buzz' print(fb or i)
Juan Perry
just check if there is a decimal. it hardly makes the problem more complicated.
Isaiah Brown
in a stressful situation like a job interview, you might freeze on the one fizzbuzz solution or you might still be able to think around the obstacle. its not about complexity
Michael Walker
literally the easiest FizzBuzz I've seen >you're hired
Easton Taylor
The basic bitch version
for x in range(1, 101): if x % 3 == 0 and x % 5 == 0: print('FizzBuzz') elif x % 3 == 0: print('Fizz') elif x % 5 == 0: print('Buzz') else: print(x)
Isaac Bailey
for (var i = 1; i
Hunter Sanders
interesting way of doing it
Adrian Smith
It makes it easy to change the fizz/buzz parameters, and it's very compact.
(I've also done this before)
Caleb Carter
Nice job, but hard to read. I know the language, but I still had to do a double take to understand this simple code.
Logan Sullivan
Feel free to entertain yourselves with trivial convolutions if you wish, but it's still just the integer rings modulo 5 and 3. You're not going to find a novel way of doing it, just ways of adding entropy to the answer.
Isaac Martin
>>would you pull the lever of the trolley problem I would walk out of my job the first day anyone referenced a meme irl
inside int main and #include stdio and all that jazz
Camden Garcia
oh God, which one is right???? do I follow the potentially buggered instructions or do I follow convention???? I JUST WANT TO BE PAID FOR MY SERVICES >Thanks for coming along to the interview, you'll hear back from us if you've been successful.
John Allen
I think the culture and stated goals on your website are a great fit for my interests and mindset
Jayden Adams
for i in range(1,101): if (i/3.0).is_integer() and (i/5.0).is_integer(): print "FizzBuzz" elif (i/3.0).is_integer(): print "Fizz" elif (i/5.0).is_integer(): print "Buzz" else: print i
Kayden Reyes
good one
Adam Reed
even still... by the time you graduate any cs program in the US you should have seen modulo, the idea that you wouldn't have is ridiculous beyond belief
I've literally only heard students saying this, I've never heard degree holders claiming that people can't fizzbuzz. You might find some funny anecdotes on reddit or something but beyond that the idea that people can't fizzbuzz is laughable. This is there to weed out the complete fakes and nothing else.
fizzbuzz = threes & fives fizz = threes - fizzbuzz buzz = fives - fizzbuzz rest = all_ - threes - fives concat = [[i, str(i)] for i in rest] + [[i, "fizz"] for i in fizz] + [[i, "buzz"] for i in buzz] + [[i, "fizzbuzz"] for i in fizzbuzz] concat.sort(key=lambda x: x[0])
print("\n".join((i[1] for i in concat)))
Adam Morgan
If we're taking the OP problem word for word, there should be a space in between 'Fizz' and 'Buzz' for the multiples of 3 and 5, you all fail.
>Fix it faggots
Nathaniel Turner
...
Noah Baker
newfag here how do i put the code panel in my post?