This is part 2 in the series. My tinder has fizz buzzed out. Hit me up if you can correctly answer this question; How would you write a fizz buzz function that takes in a number and returns “fizz” if the number is a multiple of 3, “buzz” if a multiple of 5, and “fizbuzz” if a multiple of 15? Oh and you have to do it without using string concatenation or branching statements. First person to get the right answer will get a signed cookie recipe book by Martha Stewart with organic fermented wine she made while in prison.
hawt
I saw this exact question 3 years ago in a class at Berkeley
How many female students?
Me and few others
unordered_map<int, string> a, b; a[0] = “fizz”; b[0] = “buzz”; return a[n % 3] + b[n % 5];
How would you do it if you couldn’t use string concatenation?
Lmao ^^ screw you OP
I am crying because I don't know how to code this. But I also don't want to miss my chance of dating you. What do I do?
Settle for Don Juan de bezos - a balding Johnny Depp who exudes frugality through every oily pore
Lmao wtf
I mean a lame solution similar to Amazon would be def f(x): D={3:"fizz",5:"buzz",6:"fizz",9:"fizz",10:"buzz",12:"fizz",0:"fizbuzz"} return D.get(x%15,'')
Getting that D huh
def fizzbuzz(z): D= {3: "fizz", 5: "buzz} Val = D.get(z%3+3,'') + D.get(z%5+5,'') Return val
Remember, no string cat. Also 15 is fizbuzz not fizzbuzz.
def fizzbuzz(z): D= {3: "fizz", 5: "buzz", 15: "fizbuzz"} Val0 = D.get(abs(z)%15+15,"") Val1 = "{three}{five}".format(three=str(D.get(abs(z)%3+3,'')), five=str(D.get(abs(z)%5+5,''))) Valdict = {Len(val0): val0, Len(val1): val1} Val= valdict[max(valdict)] Return val Here is your very hacky solution. Taken into account negative multiples as well
Most folks wrote code that fails if a negative number is passed. How the f did you get into those companies...
Kind of painful without conditionals.
Just use a function that sends the number to amazon mechanical turk then have a low paid vietnamese worker return the answer
LOL
I want to hypothesize a theorem, I call it SWG - Theorem. It's like CAP theorem. When you find a smart girl - she takes things too logically and can't be witty. When you find a witty girl, she has to let go of seriousness and that would mean you'd be in a friend-zone and you'd think she didn't make a smart move. When there is no girl around, the guy talks logically and it's ironically witty because you wanted a girl to talk to you. In the end you can only choose 2 - SW,WG,SG
Tech Industry
Yesterday
1073
RIP Lacework
Tech Industry
2d
53284
Goog Employees Arrested
Tech Industry
Yesterday
534
Chances of meta clearing E5 with screwing up one coding one round and acing all other
Tech Industry
Yesterday
1549
So hard being a women in tech industry
2024 Presidential Election
Yesterday
1988
Biden ruined America and tech! Tax plans are insane
O(log(n)) *wetness ensues*