To the person that advised me to know how to do fizz-buzz for my coding interview, thank you...

To the person that advised me to know how to do fizz-buzz for my coding interview, thank you. It was literally the very first question they asked me in the interview, and I nailed that shit.

Other urls found in this thread:

pastebin.com/2BE8pfAn
twitter.com/SFWRedditImages

you had to be advised?
did you, like, specially rehearse with the most interestingly well-made fizzbuzz or some shit?

Post fizzbuzzes

pastebin.com/2BE8pfAn

I haven't had to go to many interviews in my career so far but i've never been given a fizzbuzz, i was thinking its sort of a meme and most modern places won't do it. is it really that common then?

as well i can't remember who said it but it's so true that it's not a test of whether you can program well, its a test of if you know about the modulus operator

I for asked the fucking drop two eggs question and I could not remember the formula

If you don't know about the modulus operator you aren't a good programmer.

>program well
It's a test if you can program AT ALL
>its a test of if you know about the modulus operator
You don't need to use modulo for fizzbuzz

what is a fizz buzz?

Only a shitty company would ask you to do fizzbuzz nowadays.

The point of fizzbuzz was to present the applicant with a simple problem he didn't prepare for.
But since it became a meme, it became completely useless.

If you don't know about the modulus operator you aren't even a basic programmer

A meme

I used the modulator. I didn't have to but it looked more complex and impressive.

will you be getting a bill soon?

>You don't need to use modulo for fizzbuzz
omega brainlet here, would that just mean something like:
if ((number / 3) / 3 == 0) {
print("fizz")
}

Im forcing myself not to look at the modulus algorithm until I post this. Time to see how retarded I am

Its a game where people sit in a circle and count. If a number is a multiple of 3 you say fizz and if it's of 5 you say buzz. When it's both you say fizzbuzz.

oh god I really didnt think this through before posting...I see where I went wrong at least

That's just division by 9...

It can be done iteratively but that would be terrible.

fizzes = [""]*100
for a in range(2, 100, 3):
fizzes[a] += "Fizz"
for b in range(4, 100, 5):
fizzes[b] += "Buzz"
for n in range(100):
if fizzes[n]:
print(fizzes[n])
else print(n+1)

I bet Sup Forums would pay up if they got this in the mail

>Rebekah, (owner)
oy vey, who could be behind this

if any other fellow brainlets were wondering, I found simple instructions on stackexchange of how to find the remainder of a divison. I'll paraphrase it:
//1. Perform integer division. (Divide, then toss out the fractional part. Same as using // in Python)
//2. Multiply the result by the divisor
//3. Subtract that result from the dividend

// Example: 16 / 6
// 16 / 6 = 2.____
// 2 * 6 = 12
// 16 - 12 = 4
// ∴ 16 / 6 = 2 remainder 4

lul can't believe I passed multiple uni calculus courses (almost a decade ago) yet had such a hard time with this

>low level bait
You made me chuckle prick

Isn't this game more lewd than this..?

You don't have to find the remainder to see whether it's divisible

if (number / 3*3 == number)
print("fizz")

Wtf

>nailed that shit
Were I to be an employer, I would actively avoid people who at any point in their life dedicated any amount of time to learning specifically fizzbuzz.

am drunk with jgasp open, here goes:

public class FizzBuzzForAnon {

public static void main (String[] args) {
for (int i=1;i

>reverse a list
>count the number of nodes of a binary tree

This.

In all of my interviews I've been asked about OOP patterns instead.

Elaborate?

Explain the decorator pattern and provide an example, where it would be used.
Explain the factory method pattern and provide an example, where it would be used.

...

I'm still learning, what is a pattern? Is it like a superclass and subclass relationship with inheritance? Context implies that decorator and factory are classes in which you could become more specific with subclasses, but I could be way off base.

>$410
the balls

petty af desu

OOP patterns are common programming tricks to overcome the shortcomings of the OOP philosophy itself.

For example, in OOP all your code is supposed to be separated into class files and grouped together into modules (if they belong together). In order to provide a single entry method for a module, your create an additional class file with a single method: the factory method. This factory method's only purpose is to handle all the parameter and error checking of outside calls and then create and return objects from the module. Basically you want to prevent other modules from using this module directly but all funnel through this single factory method.

A factory produces things, d'uh.

Yeah that makes sense, we just covered an intro to that exact topic for an assignment. So the class file that calls objects and their methods into a coherent program, that is a "pattern" then?
If so, using a factory pattern, you would pull in whatever objects would represent machinery and workers, then use their methods do accomplish some sort of task. Is that correct?

This is TERRIBLE bait.

Yes.

Pattern means that it is a good way to organize source code. So good that other programmers like it too and steal your idea.

Well then, credit to my compsci profs for helping me learn some useful stuff in the 2 months I've been learning.