Are you able to write fizzbuzz from memory only?

Are you able to write fizzbuzz from memory only?

Other urls found in this thread:

google.com/search?q=fizzbuzz
joelgrus.com/2016/05/23/fizz-buzz-in-tensorflow/
youtube.com/watch?v=OX5TM3q-JQg
twitter.com/SFWRedditVideos

>memory only
So, like... actually capable of basic programming?

FizzBuzz is used so frequently that every script kiddie has seen its source code a dozen times.

Can you write a program that stores minutes and seconds in a single integer?

I've never bothered to actually look what fizzbuzz was, i expected it would be something complicated

for(int i = 0; i < 100; System.out.println(i++ % 3 == 0 ? i % 5 == 0 ? "Fizz" + "Buzz": "Fizz" : i % 5 == 0 ? "Buzz" : i));

best one

what do you mean "from memory"?

like not asking to clarify what fizzbuzz is? the parameters are simple - who could need a reminder? just print the number unless it's divisible by 3 (in that case "fizz") or by 5 (in that case "buzz") or by both 3 and 5 ("fizzbuzz"). this is like asking if i know how to unlock my apartment door from memory; you use the key. if you need further explanation then you have bigger problems.

if you mean "from memory" as in without checking reference documentation for the language of choice, then... sure? how hard is it to pick a pretty intuitive language and just write a for loop with some if checks? like i understand maybe it'd be hard if you chose a language you weren't familiar with, but...

this question is stupid. OP, are you stupid? do you need to ask questions like these?

Everyone but op gets it. It's not about rote memorization. Fizzbuzz is elementary branching covering four cases. If you have to memorize a solution for that, you shouldn't be working yet.

You are probably the kind of retard who cant do multiplication without memorizing the answer.

What are you talking about? FizzBuzz is one of the most complicated open problems of the field. We don't even have analytical answers, only approximations.

I have been working on my own implementation of it for nearly 6 years and the algorithm still fucks up a few times. So, if you ""solved"" it quickly you're probably not grasping the problem.

hey buddy your keyboard is broken - it repeats quotation marks

I don't get the whole fizzbuzz thing on Sup Forums. Every new programmer can solve this task easily, even without having seen any solution or variant of it before. It's extremely easy -- is it just a dumb meme?

while (num

>So, like... actually capable of potato programming?
ftfy

google.com/search?q=fizzbuzz
wikipedia should be one of the first results. it's widely known as a generic programming test. a lot more people fail it than you'd think.

i don't buy the argument that that proportion of CS graduates can't think, but i do buy the argument that that proportion of CS graduates choke in a socially uncomfortable setting like an interview. in-person programming tests are an awful way to determine programming competence. there's no aspect of it that's representative of the real work.

two alternatives that would be better are obvious (and we use the first when we interview undergrads for internships)
1) talk about a bug or error you had in some code recently, and walk through how you resolved it. (alternatively, just send us some code you've worked on lately, and ballpark estimate the time you spent writing it)
2) here's a thing we dealt with recently. take it home and work on it if you can. send us your fix and give us a ballpark of how long it took.

people are surprisingly honest about estimating past effectiveness. maybe they're afraid of exaggerating and being expected to deliver 2x or 3x as much code as they're able. we use the first option a lot because reflecting on past experience gives them an opportunity to recall the process they used to solve a problem, and that's far far FAR more informative than their ability to remember ternary operators and whatnot. also, if they can't (or won't) get very technical in the explanation of what the problem was, that tends to be a good indicator that they didn't really grok the error, and sort of just worked around it. and seeing past code (e.g. a github repo) is just nice because it gives a much more longitudinal view. but i try not to evaluate anyone on their github activity until they point me there. my public profile view looks shitty as well (mostly because most of my code is private), so who am i to judge given that i don't necessarily have the whole picture?

for i in range(1,101):
print("FizzBuzz"[i*i%3*4:8--i**4%5] or i)

find a better FizzBuzz than this
profile: you can't

fizzbuzz
did i do it?

>post increment
you fucked up

too true. kek

got a good laugh out of that one, thanks

Lost. Github link plz

In my phone, but store with
int time = minutes | (hours 8

fieebyee

i could but it would look weird. wouldn't a string be better to store that?

I don't get what you mean. Surely you'd just do
seconds + (minutes * 60) ?

apologies for trip

drugs or braindamage?

Right, now make a function that returns the minutes and a function that returns the seconds from the combined integer.

not him, but

var now = DateTime.Now;

var secs = now.Second;
var mins = now.Minute;

var tot = secs + (mins * 60);

Console.WriteLine("Untouched: {0}, Total: {1}, Min: {2}, Sec: {3}", now.ToString(), tot, (int)(tot/60), tot % 60);

>>Untouched: 23-May-16 14:34:09, Total: 2049, Min: 34, Sec: 9

x=cellstr(int2str((1:100)'));
x(3:3:end)=cellstr('Fizz');
x(5:5:end)=cellstr('Buzz');
x(15:15:end)=cellstr('FizzBuzz');
fprintf('%s\n',x{:});

You got it.

dain bramage?

function combine_time(seconds, minutes) {
return seconds + (minutes * 60);
}

function extract_minutes(time) {
return floor(time / 60);
}

function extract_seconds(time) {
return time - (floor(time/60) * 60)
}

>0xFF

It will be probably optimized by the compiler, but write 0xFF00 if you want to.

union { struct { int hours:8; int minutes:8} s int stamp;} time = {.s.hours=13, .s.minutes = 37};
//printf("Time is %d:%d, timestamp is %d", time.s.hours, time.s.minutes, time.stamp);


Using bitwise is boring.

print('\n'.join(["FizzBuzz"[i*i%3*4:8--i**4%5] or str(i) for i in range(1,101)]))

_=$=+!![];$__=((_$={})+'')[_+$+_+$+_];__$=((![])+'')[$];_$_=((_$={})+'')
[_+$+_+$+_+$];____=[][$__+((_$={})+'')[$]+(($)/(![])+'')[$]+$__+__$+_$_];$__$=(!![]+"")
[$+$+$]+([][(![]+"")[$+$+$]+(+[]+{})[$+$]+(!![]+"")[$]+(!![]+"")[+[]]]+"")[($+$)+""+
($+$+$)]+(![]+"")[$]+(![]+"")[$+$];$_$_=____()[$-$][$__$]("\"\\"+($)+($+$+$+$+$+$+$)+
($+$)+"\"");_$=(![]+'')[$-$]+([][[]]+[])[$+$+$+$+$]+$_$_+$_$_;$_=(_+{})[$+$+$]+(!![]+'')
[_+$]+$_$_+$_$_;_--,$$=$+$;____()[$-$][$__$]((![]+"")[+[]]+(+[]+{})[$+$]+(!![]+"")[$]+
"(;++_;)$$$=!(_%("+($$+$$+$)+")),____()[+[]][__$+((![])+'')["+($+$)+"]+((!![])+'')["+
($+$+$)+"]+((!![])+'')[+!![]]+_$_](!(_%("+($$+$)+"))?$$$?_$+$_:_$:$$$?$_:_);");

javascript

...

I dream of fizzbuzz.

Sometimes when I wake all of the computers in the house are running fizzbuzz. Even the androids.

I have a special key that adds double quotation marks, it is very useful when arguing here.

Just look up 'computing with positronic brains fizzbuzz' to find my paper.

Name 1 (one) scenario where it would be reasonable to do that

I know this post is old as fuck but I want to make sure I'm not retarded.

>Store minutes and seconds in a single integer
You just store seconds and when reading the number for display you format it correctly by dividing by 60 for minutes and formating the remainder for seconds.
Is the point that it's a trick question?
Like are idiots supposed to respond by merging two integers (minutes and seconds) with a token into a string then parsing the string using the token when reading it?

Name a scenario where FizzBuzz would be reasonable

Beautiful but it doesn't work

>Uncaught TypeError: Array.prototype.concat called on null or undefined(…)

Every programming job interview

It's a small problem that looks like it can be solved in a pretty elegant way but it's silly to actually try.

I've seen many people make the program write "fizz" then "buzz" then go "ok now how do I make it write them both in the same line when it's needed" so then they make a variable which holds the text that must be written and they change the value of the variable around depending on the case and it goes to shit from then on.

I wonder if the success rate of the problem would change if instead of "fizz" "buzz" "fizzbuzz" it was something like "blue" "red" "yellow"

>write a program that stores minutes and seconds in a single integer
>how do timestamps work

Yes, but only because I praise Jesus everyday

not really. Between 1 and 100 - if it divides by 3, Fizz, if it divides by 5 - Buzz. if both, both.

#include

int main(void){
int i;
for( i = 0; i < 100; i++ ){
if( i % 15 == 0 )
puts("FIZZBUZZ");
else if( i % 5 == 0 )
puts("FIZZ")
else if( i % 3 == 0 )
puts("BUZZ")
else
printf("%d\n", i);
}

return 0;
}

for (var i=1; i

btw, if you have a CS degree and can't write fizzbuzz without the google in at least one language, then you are literally worthless.

#include
#include

#define FIZZBUZZ_CASE(term) case term: printf("FizzBuzz"); break
#define FIZZ_CASE(term) case term: printf("Fizz"); break
#define BUZZ_CASE(term) case term: printf("Buzz"); break
#define EMPTY_CASE(term) case term:
#define NORMAL_CASE(term) case term: printf("%d", i); break

int main(void)
{
int i;
for (i = 1; i = 0) j = j - 15;

switch (j)
{
FIZZBUZZ_CASE(0);
EMPTY_CASE(1);
NORMAL_CASE(2);
FIZZ_CASE(3);
NORMAL_CASE(4);
BUZZ_CASE(5);
FIZZ_CASE(6);
EMPTY_CASE(7);
NORMAL_CASE(8);
FIZZ_CASE(9);
BUZZ_CASE(10);
NORMAL_CASE(11);
FIZZ_CASE(12);
EMPTY_CASE(13);
NORMAL_CASE(14);
}
printf("\n");
}

return 0;
}

been working with Lua lately so let's use that
while true do
i = i + 1
fb = nil
if i / 3 == math.floor(i / 3) then
outstat = "f"
end
if i / 5 == math.floor(i / 5) then
outstat = outstat + "b"
end
if outstat == "f" then
print("fizz\n")
elseif outstat == "b" then
print("buzz\n")
elseif outstat == "fb" then
print("fizzbuzz\n")
else
print(i, "\n")
end
end

I know I didn't use % or MOD, I can't remember if Lua has those or in what form

I really hope I never have the 'pleasure' of working with somebody like you.

static int a(byte min, byte sec) {
return (min

sorry,
static int a(byte min, byte sec) {
return (min

Not hard, use an unsigned integer, the last six bits are used for seconds and the rest of the bits are used for minutes. Add one to the integer ever second, and Once the last six bits reaches 59 seconds add one to the next bit and set those six bits to zero. Reverse engineer to display correctly

Fucking easier than shit dude.

fizz = int % 3 == 0;
buzz = int % 5 == 0;

for int in range(1,101)
if int == fizz:
print ('fizz')
elif int == buzz:
print ('buzz')
elif int == fizz & buzz
print ('fizzbuzz')
else:
print (int)

Probably something like this. It might be ugly and long, however it's readable and simple.

>Lurk Sup Forums because I'm sick and bored
>Not a programmer, not even close
>Dick around with AVR microcontrollers for fun and lua for gaymin scripts
>See this thread
>Look up what fizzbuzz is

Holy fuck. There are people who went to school for this that can't write a simple loop, or swap two variables without using a third temporary variable.

I think I am starting to understand the reason why so many graduates are crying about how they can't get a job.

bah, meant to rename "fb" to "outstat"

I can write self-learning fizzbuzz in TensorFlow joelgrus.com/2016/05/23/fizz-buzz-in-tensorflow/

>joelgrus.com/2016/05/23/fizz-buzz-in-tensorflow/
what the fuck man.

>how to humiliate the interviewer with your deep learning skills

I guess it's because i don't know how neural networks work, but i can't make sense of what the fuck went on.

It's half meme half truth, but he applied a simple multilayer perceptron to learn which numbers should map to fizz, buzz or fizzbuzz. Machine Learning: when you have a hammer everything looks like a nail.

Learning to snap together Java and Python is what Computer Science is now.

Also you will be expected to take a labless digital logic course that's suitable for third graders from the 1980s (see Robot Odyssey).

I actually had a fizz buzz test for an interview and I did it wrong. I put the 'and' clause after the two ifs. I blame it on nerves, but, really, I'm just a retard.

int minutes(int time) {
return minutes / 60;
}

int seconds(int time) {
return time;
}

Better to be able to write merge sort or realloc from memory.

Careful: Leap seconds just fucked you in the ass.

job interview

>from memory
so you can't actually figure it out for yourself?
OP, never stop being such a titanic faggot, don't you dare to stop surrendering your ass to random famalams while doing so.

its the only thing I can do from memory only

define a function called "fizzbuzz". fizzbuzz shall work as follows:
start counting a number "x" from 1 to 100.
if x is divisible by 3 and 5, then say "fizzbuzz". Otherwise,
if x is divisible by 3, then say "fizz". Otherwise,
if x is divisible by 5, then say "buzz". Otherwise,
say the value of x.

Yes

for(var i = 1; i

>programming from memory
kek, okay kids.

What language is this?

English.

Fag#

>i%15
code discarded

Hold the phoneeeee

I thought if the condition is true, it executes the statement following the question mark, not the colon. What am I not understanding?

No, because I can't remember the retarded game.
I can solve it, but I don't remember what the "problem" is.

i % 3 is true when i isn't divisible by 3

I never knew what fizz buzz was and I always just ignored these type of threads. Just looked it up today and did it within 5 minutes. The fact that some people can't do this immediately is pathetic and I haven't even started my CS courses yet.

b-but math is scary... :(

/* fizzbuzz in C */
#include
int main(void)
{
int i;
for(i = 1; i

It's designed to be a very quick way to eliminate the people who just don't know how to program very early in the interview process.

Honestly why would you try to get a job programming if you can't program. Wouldn't someone find out pretty fast?

yeah, but this isn't true of a lot of industries/jobs and some people think software is the same way

you can BS your way into a lot of fields and people won't find out for weeks.

Oh Jesus Christ. I had a lapse there. Forgot i % 15 == 0 == false when it's divisible by 15.

print('1,2,Fizz,4,Buzz,Fizz,7,8,Fizz,Buzz,11,Fizz,13,14,FizzBuzz,16,17,Fizz,19,Buzz,Fizz,...');

How dare you insult Javascript? The most Beautiful and Practical of languages?

...

unsigned int seconds 50000;

unsigned int
to_minutes (unsigned int sec) {
unsigned int mins;
while ( sec-->60) mins++;
return mins;
}

same for hours desu~!

wow this thread makes me feel good about myself. I thought I sucked at programming.

I know the concept
do a for loop
each time you add 1 check if modulus by 3 or 5 = 0
if it does for 3, fizz
if it does for 5, buzz
if it does for both, fizzbuzz
end the for loop at 100

>fizzbuzz
youtube.com/watch?v=OX5TM3q-JQg

I JUST LEARN FROM PAJEET OP!