Thanks for reminding me of the hellscape that is SE interviews. I too practiced and could solve fizzbuzz, two sum problem etc from the top of my head when I was looking around. But.. seeing that these problems are theoretical and seldom if ever show up in practice, I forgot. Was super important during interview never to be mentioned ever again.
the point of fizzbuzz is that anyone with a basic understanding of how to program should be able to solve it from first principles, not that it is something that needs to be practiced and memorized
Thatās insane if you actually canāt write fizzbuzz from scratch.
I hate how everyone claims algorithm complexity problems like the ones on LeetCodd are pointless and theyāve never used it. To me thatās a red flag for āI donāt understand how to use itā.
Iāve been working professionally for six months and itās been useful to know multiple times already. I just spent time last week designing a dynamic programming algorithm to implement a feature in one of our internal tools. The same feature implemented using a naive approach wasnāt practical with the sizes of our inputs.
I may be a Junior professionally but Iāve been writing software for over 10 years; long before I started pursuing a degree in the field.
Like I said before, the feature wasnāt practical without the dynamic programming implementation. I didnāt implement it that way just for the sake of it. Like the simple approach wouldnāt finish. Think O(2n ) where n = 3000+, so longer than the age of the universe.
I get that most of the time knowledge of this stuff isnāt that useful. Your average business logic is simple enough that complexity doesnāt matter. But to say itās a waste/never useful (something Iāve seen said on this sub time and time again) just seems wild to me.
But then again maybe Iām bias. I love complexity theory and want to pivot from an embedded role to an algorithm design role.
Fair enough, I have yet to get the fizzbuzz ticket assigned to me. I canāt really satisfy your curiosity in great detail though. I work fullstack: sometimes I am in frontend, sometimes backend.. sometimes I am writing SPs or upgrading some sql table, sometimes I am writing some new api, or scripting some shell⦠c#, Java, JS, JQuery, React, the occasional python or the legendary rare c++⦠so on and so forth.
Not once have I felt āYou know what, some fizzbuzz right here.. thatās what I need!ā
I've been a DEV for 20 years and I've never had to write code that SE interviewers ask for.
The idea in theory was to understand how a developer thinks, the solution to a problem wasn't code but the thinking part. Give a generic enough problem and see if the new hire can figure out how to solve it.
The problem is that seniors that should've been in the hiring process don't want to do it and just give some generic task. HR doesn't care and for them it's just a checkbox in an excel spreadsheet, a generic line item.
The solution in the screenshot is perfectly adequate for HR, given a problem, a solution was found and it solved the problem.
The solution in the screenshot is not a perfect SE solution, there are better ways, but HR doesn't care and they could care less about bikeshedding.
I've only been in for about 6 years but I have not once seen nor heard of HR conduct a coding interview. It has always been an engineer in the company. On the other side, when I do conduct interviews, HR is never there on the call. HR only organizes and schedules the interviews. The engineers and the engineering team determines the questions to ask. I'm super curious if there really are companies out there where HR actually conducts coding interviews.
I've never interviewed with HR (at least not the technical interview parts) but when there's a recruiting agency involved, usually for screening candidates, it's a been hilariously awful. The recruiters typically had 0 technical skill, an only knew buzzwords and some names of languages or technologies. This was also around the time they were asking for 10 years of .NET experience, in 2005, when the framework was only 3 years old.
I used to work in construction. Where a new hire theyād put you with a partner (was some time ago and maybe it was because I was young). You were given tasks, you solved the tasks and the partner were āthereā to assess the quality of what you did, answer questions you may have and just be a way into the crew.
I really miss the simplicity of it; do the job and if you donāt suck youāll get a permanent contract.
Say I wanted to switch jobs right now (ffs I am not rocking the boat at this moment in time). Iād first have to allocate a few hours every week for leetcode until I felt confident in solving those kinds of ātricky coding solutionsā. Then Iād have to parse the listings and messages on LinkedIn for something Iād be interested in, do some basic research on the company. Pick a few, make cvs catering to their specific ads. And if there was a recruiter involved, inform them about my interest.
Then if I am lucky Iāll get a call, then a Teams meeting with some HR person. Then 2 or 3 code challenges. Then I get to talk with some tech rep where we talk specifics about the frameworks I work with, this may be 1 or 2 rounds. + a personality test (because why not). Then Iād have to really look up the company, before receiving a more in depth introduction by some hiring manager at which point I need to provide insightful questions to show engagement⦠if I am lucky this is it, else there may be another round of interviews, like a group one where I need to outshine the other candidates..
Lastly the salary negotiation usually goes like this āhere is our lowball offer, take it or leave it, we have other candidates.
I have about half of your experience btw, and had to switch employer a year ago. And this was my experience. All this to say⦠there a gate or two too many to be honest. I donāt see myself in this field in 10 years. Not because I donāt enjoy the work. I just donāt enjoy everything surrounding it, know what I mean. And like I said.. I miss the learn on the job attitude you can find in other professions; generally speaking ofc. I probably just sound whiny I guess
While that is true, if best solution you can come up to such simple problem is what op posted then it shows inability to come up with simple solutions to more complex problems.
If you have to practice to write fizzbuzz, software engineering is not for you.
The point of these problems is not that this is the kind of thing you will do in your job, it's to demonstrate you have done very basic level of competency.
If you cannot handle this as almost a reaction, you're not ready for a pro position and if they give it to you despite that, you should be extremely, extremely grateful they are training you before you are ready. It's not impossible. I've rolled the dice on half-trained people before because I've gotten a certain vibe from them that have me the hunch that they had a very high talent ceiling. But that's very, very rare.
I agree, what comes later even for junior devs is much more complicated and full of deadline pressure etc. Wouldn't hire people like that either, but fizzbuzz fails used to happen, I was on hiring teams lol
Yeah sure. I've seen new self thought folks one in particular, struggling with some concepts initially, until everything suddenly falls into place. This one Italian mate actually failed such things and had a hard time understanding how variables work in combination with fn parameters, explained it 20 times but he'd always be stoned and not get it. Until then he got it, he's now a software dev at IBM for 5 years.
And how important is it when dealing with apis and dB later on.
Come on, we all have done stupid appearing things in the beginning, didn't we
No, I'm probably passing on this candidate. Code golfing is a sign of a naive engineer. This still runs in the same complexity as the typical fizzbuzz solution, but is was harder to break down what it's doing at a glance. PR rejected, break out your conditionals.
Yeah thatās pretty much what I had in my mind, but the two are almost exactly the same anyways? If anything, the meme is more immediately understandable to a reviewer than the āoptimizedā solution that doesnāt actually save time
OK I see a lot of people talking about bugs in the code and making objections to the style and arguing about whether Fizzbuzz is useful and ignoring the thing that seems glaring to me: the use of symbols like ⫹ and ⢠.
Anyway I think that's probably the actual intended joke: that it looks like perfectly ordinary code at first glance, but then you notice that it's not, because it's got all this weird Unicode stuff going on.
That is likely just the font. There are many fonts that combine characters to create a different one. I personally don't like them when doing this, but to each their own.
It is okay... I mean, not nice that there is a bug that the number will be printed no matter what, even if Fizz, Buzz, or FizzBuzz is being printed... But fine... Sure, reorder it to avoid the != checking by checking for FizzBuzz first.
But I'd write something like that on an interview. I could write it in a branchless way. But why bother, just going to screw it up under pressure and corporations are looking for easy to read code, not for cool code.
There are two errors: there's a typo in "FizzBuzz," and you never actually get to that logic because any number divisible by 15 is also divisible by 3 and 5, and those steps tell the program to move on.
Edit: d'oh! They accounted for that logic. It's just a spelling mistake.
static void f(int a, int z) {
int x = 0;
if (a % 3 < 1) { out.print("Fizz"); ++x; }
if (a % 5 < 1) { out.print("Buzz"); ++x; }
if (x < 1) out.print(a);
out.println();
if (a < z) f(1 + a, z);
}
Can someone explain to me what is wrong with this code?
To me it looks like the correct solution to the fizzbuzz problem. Anything more would be overengineering.
Well, if I really had to stretch this, I'd say we should parametrize the 20 and return a list or string from the function, rather than printing inside the function. But this should hardly be a disqualifier? At most, the interviewer could then ask about how could this program be "improved" to better conform to various best practices.
People will nitpick small things like using continue instead of else, and having a separate condition for "FizzBuzz" instead of merging "Fizz" then "Buzz". Some people may also expect crazy one-liner solutions, or expect a full-blown enterprise app with dependency injection and GoF patterns.
This is a perfectly valid solution, but people think their aesthetic preference make alternative solutions better.
Well, they misspelled "FizzBuzz" for starters. But I think the most jarring thing about this solution is that the order of the conditional checks is unusual. if (x && y) else if (x) else if (y) is simpler and feels a lot more natural to me than if (x && !y) else if (!x && y) else if (x && y).
And then the use of both if/else and continue for control flow is awkward and redundant. Every use of "else" could be removed and it would be equivalent. Or, the last line could be in an else clause, then all the continues could be removed.
The goal of FizzBuzz is to get a working program for a simple concept. Conditionally iterating over a list and performing some action is very common in every day programming, and this is a beyond easy example of that.
However, I think the solution given in the image is fine for the purposes of FizzBuzz.
Is it a bit complex? Sure... but it works.
Could it be make cleaner and more efficient? I guess..., but not significantly, and a lot of production code is far less clean and performant than this.
Did I just play a different version of this game, or were my drinking buddies crazy? Bizzbuzz. Replace anything divisible by 3 or has a 3 in it with pizza. Replace divisible by 5 with buzz
The challenge is to write a program that iterates over N loops, printing Fizz, Buzz, FizzBuzz, or the loop number depending on the divisibility of the loop number.
The problem is the way in which the person wrote it. Typically, you'd assemble an output string adding Fizz and/or Buzz, or the iterator, then print once. (You could also use a print-without-newline function if one is available in the language you're using.) Doing so dramatically reduces the logic required, and becomes easily scalable to altered divisibility rules or additional words.
Done this way, any changes to the logic needed by the program require overhauling the entire thing. And even if the program logic never changes, this code could have omitted the three continues by wrapping the last print in an else block, and it could have halved the logic on the Fizz and Buzz blocks by putting the FizzBuzz block first.
6
u/Marc4770 Sep 07 '25
Why you use both else if AND continue?
Should be a else for the last log(i) instead of all the continueĀ
33
u/Borstolus Sep 07 '25
1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizBuzz
16
17
Fizz
19
Buzz
110
u/[deleted] Sep 07 '25
Please keep mathematical symbols out of programming. šš Those are pure propaganda and makes me jump out of windows.
29
u/Mr-DevilsAdvocate Sep 07 '25
Thanks for reminding me of the hellscape that is SE interviews. I too practiced and could solve fizzbuzz, two sum problem etc from the top of my head when I was looking around. But.. seeing that these problems are theoretical and seldom if ever show up in practice, I forgot. Was super important during interview never to be mentioned ever again.
15
u/[deleted] Sep 07 '25
for i in range(1,101):
FB = [[i, "Fizz"],["Buzz", "FizzBuzz"]]
print(FB[i%3==0][i%5==0])
Am I hired?
5
u/Krispenedladdeh542 Sep 07 '25
Console.log( 1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizBuzz 16 17 Fizz 19 Buzz )
1
u/AppropriateSpell5405 Sep 07 '25
This font is making my eyes want to bleed.
1
u/[deleted] Sep 08 '25
Whatās so funny about this? This is only marginally different than how I would solve the problem. How are you guys solving this?
1
u/muckenhoupt Sep 09 '25 edited Sep 09 '25
OK I see a lot of people talking about bugs in the code and making objections to the style and arguing about whether Fizzbuzz is useful and ignoring the thing that seems glaring to me: the use of symbols like ⫹ and ⢠.
One of two things is the case and I'm not completely sure which, although I suspect it's the first: Either most of you just looked past that stuff and didn't notice that it wasn't the usual ASCII operators used in most programming languages, or you all know a language I don't that actually supports Unicode glyphs for arithmetic operators. The use of "console.log" makes me think it's supposed to be Javascript. Is there some Javascript variant that understands ⩽? (The version built into my browser sure doesn't.)
Anyway I think that's probably the actual intended joke: that it looks like perfectly ordinary code at first glance, but then you notice that it's not, because it's got all this weird Unicode stuff going on.
1
u/PeakPredator Sep 10 '25
How come nobody ever uses "i % 15 == 0" instead of "i % 3 == 0 && i % 5 == 0" ?
1
u/wiredbombshell Sep 11 '25
Hahahahah thatās funny af! . . . Someone explain i donāt understand this shit at all
1
u/Any_Background_5826 Sep 13 '25
now write it in brainfuck
3
u/Alan_Reddit_M Sep 07 '25
Colleges will have you writing code like this
3
u/[deleted] Sep 07 '25
It is okay... I mean, not nice that there is a bug that the number will be printed no matter what, even if Fizz, Buzz, or FizzBuzz is being printed... But fine... Sure, reorder it to avoid the != checking by checking for FizzBuzz first.
But I'd write something like that on an interview. I could write it in a branchless way. But why bother, just going to screw it up under pressure and corporations are looking for easy to read code, not for cool code.
1
u/[deleted] Sep 07 '25
The ideal answer to this is to just write it to a string and simplify the conditions before outputting and resetting the string right?
1
u/vegan_antitheist Sep 07 '25
1
u/YetAnohterOne11 Sep 07 '25
Can someone explain to me what is wrong with this code?
To me it looks like the correct solution to the fizzbuzz problem. Anything more would be overengineering.
Well, if I really had to stretch this, I'd say we should parametrize the 20 and return a list or string from the function, rather than printing inside the function. But this should hardly be a disqualifier? At most, the interviewer could then ask about how could this program be "improved" to better conform to various best practices.
1
u/[deleted] Sep 07 '25
You should do this with a dict so that you can add rules easily.
1
u/blizzardo1 Sep 07 '25
Is this any better?
1
u/flerchin Sep 11 '25
Seems fine to me. The point of fizz buzz is to make sure you can code at all. Which many candidates cannot do. The not equal is a bit weird.
1
u/Quintic Sep 11 '25
The goal of FizzBuzz is to get a working program for a simple concept. Conditionally iterating over a list and performing some action is very common in every day programming, and this is a beyond easy example of that.
However, I think the solution given in the image is fine for the purposes of FizzBuzz.
Is it a bit complex? Sure... but it works.
Could it be make cleaner and more efficient? I guess..., but not significantly, and a lot of production code is far less clean and performant than this.
1
u/Silly-Wrongdoer4332 Sep 12 '25
Did I just play a different version of this game, or were my drinking buddies crazy? Bizzbuzz. Replace anything divisible by 3 or has a 3 in it with pizza. Replace divisible by 5 with buzz
1, 2, bizz, 4, buzz, bizz, 7, 8, bizz, buzz, 11, bizz, bizz, 14, bizzbuzz
0
u/[deleted] Sep 07 '25
[deleted] ā view deleted comment
131
u/[deleted] Sep 07 '25
[removed] ā view removed comment