6 ms·
Anyone with a CS degree can write a fizzbuz
by 2_listerine_pls 8y ago
Anyone with a CS degree can write a fizzbuz
- QuercusMax 8y agoWow, didn't realize this was a comedy site. Speaking from personal experience, the number of people with multiple years of experience and multiple degrees in CS (usually BS and MS) who can't pass FizzBuzz is really high.
- jki275 8y agoThat's amazing to me. Not arguing you're wrong, I'm not interviewing people, just amazes me that anyone with degrees in CS would not be able to solve such a basic problem.
- deleted 8y ago[deleted]
- geebee 8y agoI don't understand this either. There is an interesting blog post that suggests maybe some programmers get tripped up because they want to find a more clever way to do it: http://www.gayle.com/blog/2016/1/fizzbuzz-youre-doing-something-wrong http://www.gayle.com/blog/2016/1/fizzbuzz-youre-doing-someth... It doesn't sound like this is the problem, though, in all the cases. It sounds like someone who majored in CS was unable to write this. Which seems inconceivable to me. And yeah, "inconceivable" is often based on wrong assumptions (it was the basis of one of the oft-repeated lines from cinema: you keep using that word. I do not think it means what you think it means). But... is there a chance that maybe "CS" just means different things from different programs. I feel like it should be... well, impossible for someone who graduates from a proper CS program to fail to write fizz buzz. I know, I know, the "no true scotsman" is already getting typed into the response field. But here's the thing, I'm not defining a "proper" program as one that results in an ability to write fizz buzz. I'm defining it as a program that contains, at a minimum, basic algrothmns and data structures. Do people graduate with CS degrees without coding a linked list, binary tree, doing basic sorting, and set permutations? I'd say if you take that one required class, it should be more or less impossible to not write fizz buzz. I'd be interested in knowing what the "CS" curriculum was for people who can't write this.
- jki275 8y agoYou don't even need algorithms or data structures -- it's a cs101/151 problem at best. When I first saw the problem the solution appeared self evident to me -- I've been coding since the 80s, but still. It's just a simple problem and writing the pseudocode for a question like it ought to be almost second nature to anyone who has done any coding at all. I know people confuse CS and IT/CIS, but even at that, those majors generally require at least one basic CS class.
- geebee 8y agoI agree, you don't need data structures for fizz buzz. In fact, I think it would be tough to pass data structures if you weren't at the level where you could write fizzbuzz, so it's more or a pre-req. I have trouble imagining what is taught in a CS program that doesn't have a course in data structures and algorithms. How can it be CS? That said... I keep hearing about fizzbuzz, and I'm not sure what I think of the complaint. I hear something along the lines of "We need to do technical screening because you wouldn't believe how many people can't do fizz buzz", but the questions aren't fizz buzz, they're "find all matching subtrees in a binary tree", often at the whiteboard, in 45 minutes. I'm not saying that this is (or isn't) unreasonable, just that there's an awful big difference between fizz buzz and the kind of questions I've encountered in a typical tech interview.
- ryandrake 8y agoBoth candidates are in abundance. I know plenty of “engineers” who can’t do fizzbuz. I also know talented developers who can do fizzbuz for you in 60 seconds, but might not be able to invert your binary tree on a whiteboard in that amount of time. Neither of them are getting past today’s ultra picky interview-hazing rituals. One probably shouldn’t get hired while the other should. Companies seem to have a hard time distinguishing them.
- QuercusMax 8y agoYou'd be shocked how many people don't know about the modulus operator.
- jki275 8y agoThat's a fair point, but not even knowing about the concept?
- repsilat 8y agoEven so... try dividing. If it looks like division truncates, check the product. If it looks like floating point division, check if rounding/truncation changes the value. Or keep two extra counters that you increment every iteration and reset when they hit 3 or 5. Not knowing modulus or bitwise ops etc isn't a good sign, but it isn't disqualifying. Not being able to get fizzbuzz working should be disqualifying, though, unless you're willing to teach someone to program completely.
- pkaye 8y agoI agree with the parent comment. So many people just can't code the most basic program correctly. And this is with a generous amount of time and forgiving syntax errors.
- stale2002 8y agoWell, it is a little bit more complicated than that. I am sure that any CS major couos write fizz buzz, on their computer, for the purpose of their homework assignment or whatever. Whether or not they can do the same thing, in 15 minutes, on a whiteboard in front of someone is a different story. The moral of this story is that writing code, on a blank slate, while having to have all the syntax memorized, and having everything conpile without having access to a compiler, is a real skill that many people haven't even attempted to do.
- QuercusMax 8y agoIf you're applying for a job as a full-time software developer, you should be able to write something that is comprehensible without having a syntax reference. I straight-up tell people I don't care if you use the wrong method name (in Python is it ends_with() or endswith? toupper, to_upper, or upcase?). Heck, I even tell them I don't care what language it is as long as it's not too weird. A few months back I interviewed someone who was currently employed as a software engineer at a major company in Silicon Valley, who couldn't even figure out how to write a tiny little program which kept track of state across method calls. I told him that he could store the state in global variables, make an object to track the state, or anything else he wanted; still couldn't make any progress outside creating a single stateless function. I was truly puzzled.
- drdrey 8y agoWhat is the explanation? Presumably, to get a CS degree you had to solve problems harder than FizzBuzz, no? Are we suggesting these people cheated their way to a CS degree?
- 50 8y agoIs the correct and most efficient way to solve it? #include <iostream> using namespace std; int main() { for (int i = 1; i <= 100; i++) { if ((i % 3 == 0) && (i % 5 == 0)) cout << "FizzBuzz" << endl; else if (i % 3 == 0) cout << "Fizz" << endl; else if (i % 5 == 0) cout << "Buzz" << endl; else cout << i << endl; } }
- 0xffff2 8y agoOff the top of my head, you can do a single mod 15 for the first case. I'm sure there are other micro optimizations, but really being able to write exactly what you did is sufficient to move on to real questions that actually have something to do with the job you're interviewing for.
- Metricon 8y agoTechnically, this would be more efficient: #include <iostream> using namespace std; int main() { for (int i = 1; i <= 100; i++) { bool t = (i % 3 == 0); bool f = (i % 5 == 0); if (!t && !f) { cout << i << endl; continue; } if (t) cout << "Fizz"; if (f) cout << "Buzz"; cout << endl; } } But most interviewers are interested in the basic logic of the process.
- mindcrime 8y agoAnyone with a CS degree can write a fizzbuz That's not even close to true. I've interviewed people with Ph.D.'s in Computer Science and a documented 10+ years of experience as a "developer" of some sort, who can't write Fizzbuzz.