Live data from Hacker News

Fizzbuzz, Interviews, And Overthinking

dave.fayr.am

91–100 of 115 posts

Re: Fizzbuzz, Interviews, And Overthinking

#91
post #25

cases = ( (3, 'Fizz'), (5, 'Buzz'), (7, 'Bazz'), (11, 'Boo'), (13, 'Blip'), ) for i in range(1, 101): out = [] for c in cases: if i % c[0] == 0: out.append(c[1]) if out: print ''.join(out) else: print i Edit: not to detract from the post's point, I think it's valid. Monoids are cool and all but simple counting arguments can take you a long, long, long, way when case analysis fails you.

Halfway through the article, I'd write the Python as:

    for i in xrange(1, 101):
        s = ""
        if not i % 3:
            s += "Fizz"
        if not i % 5:
            s += "Buzz"
        if not i % 7:
            s += "Bazz"
        print s or i
Which can be shortened to:

    for i in xrange(1, 101):
        s = ""
        s += "Fizz" if i % 3 == 0 else ""
        s += "Buzz" if i % 5 == 0 else ""
        s += "Bazz" if i % 7 == 0 else ""
        print s or i
Finishing the article inspired:

    print "\n".join(
        "".join(filter(None, ("Fizz" if i % 3 == 0 else None,
                              "Buzz" if i % 5 == 0 else None,
                              "Bazz" if i % 7 == 0 else None)))
        or str(i) for i in xrange(1, 101))

Re: Fizzbuzz, Interviews, And Overthinking

#92
post #86
post #41

Earlier quoted context omitted.

I assume the question is something along the lines of "Implement a strrev in the language of your choice" , not "Use the strrev equivalent in the language of your choice" .

Even with this addendum, there is a grey zone: reversed_string = string[::-1] Is it just using the equivalent, or a new implementation?

If I was the interviewer in that case I would probably accept that, with note that the person seemed clever. Then I would ask another harder question that I would hope would trip them up if they didn't understand iteration.

Re: Fizzbuzz, Interviews, And Overthinking

#93

First of all a modulo is ultra expensive, one does not simply modulo 15 when they already modulo 3 and 5. The proper structure is if(3){if(5)}elif(5){}else{},unless anyone has a better proposition. While of course it is possible to define abstractions that handle fizzbuzzing anything for any number, it's clear that the monoid way is a bad overweight bloated approach. Second the example written is code bloat à la java…

This is another example of someone who I think looked at my code examples but didn't read the post. Fair enough, I guess.

> While of course it is possible to define abstractions that handle fizzbuzzing anything for any number, it's clear that the monoid way is a bad overweight bloated approach.

Why? It is not computationally expensive, and it avoids excess modulo operations. All the dispatching work gets figured out at compile time and you end up with pretty much the same sorts of string concatenation costs you get in every other implementation.

Do you mean to suggest that it is conceptually expensive?

> Lastly functional and procedural programming enable you to work at the highest level of abstraction you can think of, whereas OO tends to lock you at a specific abstraction level, which is pretty low and not adapted to most cases.

I actually agree with this, although I sort of question procedural's place on the totem. I suppose stuff like Forth suggests you're right.

Re: Fizzbuzz, Interviews, And Overthinking

#94
post #88

Earlier quoted context omitted.

It's not about whether they can do it or not. It's about why knowing a skill that will take even a non-developer ten seconds to Google makes someone incapable of functioning as a developer. More often than not the people that spout that kind of nonsense are twenty-something junior developers that read a bit of HN and have decided that they know better than everyone else about what makes a good programmer. Why would y…

It takes someone who doesn't speak English ten seconds to look up the past tense of the verb "bring" - this doesn't mean you'd want to hire as a journalist someone who seems to think the answer is "bringed" Doing a string reverse is so trivial that it's not about needing that skill, but rather what not being able to do that speaks about the candidate's general aptitude and skill level.

"Why would you test if someone can reverse a string if you're hiring someone to maintain and build on some shitty web app?"

If that question can't be answered then your opinion on someones skill level is irrelevant. Also, if you've got time, answer the questions in my first post:

"How old are you? Have you hired developers before? Truthfully, have you ever had to reverse a string under pressure at your current job."

Re: Fizzbuzz, Interviews, And Overthinking

#95
post #52
post #15

Earlier quoted context omitted.

I would prefer to force candidates to implement FizzBuzz in a language invented solely for purposes of that interview (and which will never be used again). This places all candidates on the same level. It's probably a good thing I don't interview people for programming positions...

You have so little time in an interview to learn so much you can't afford to lose the time to both learn whether they can do FizzBuzz (or whatever other problem) and whether they can manipulate some language of interest, when you could be learning both The purpose of an interview isn't to be abstractly "fair", it's to find the best candidates for the job. You choose what "best" is (which is to say, please don't put w…

I thought it was pretty clear based on the second sentence that the comment was intended as a joke. Do I really need to start adding /jk to the end of my comments?

Re: Fizzbuzz, Interviews, And Overthinking

#96
post #94

Earlier quoted context omitted.

It takes someone who doesn't speak English ten seconds to look up the past tense of the verb "bring" - this doesn't mean you'd want to hire as a journalist someone who seems to think the answer is "bringed" Doing a string reverse is so trivial that it's not about needing that skill, but rather what not being able to do that speaks about the candidate's general aptitude and skill level.

"Why would you test if someone can reverse a string if you're hiring someone to maintain and build on some shitty web app?" If that question can't be answered then your opinion on someones skill level is irrelevant. Also, if you've got time, answer the questions in my first post: "How old are you? Have you hired developers before? Truthfully, have you ever had to reverse a string under pressure at your current job."

Because anyone who can't do this almost certainly doesn't have the ability to program any software system well, some shitty web app or otherwise. You're not trying to fill out a remedial CS course in community college, you're trying to get someone to program real things real people use.

The only way this question wouldn't be useful is if you had a good filter such that almost everyone who gets to that point would answer that question correctly. But apparently, this is not the case. There are people who fail such tests (despite apparently good paper qualifications and ability to talk BS). It's fairly important that you not let through such imposters.

And yes I've hired people and all of them have had to answer much more complex algorithmic questions to get the job and all of them turned out to be competent. And "have you ever had to" questions are ingenuous - interview settings are never going to be replicated exactly in a work setting, unless your job is to go around to be interviewed for different jobs. Good interview questions don't simulate work setting - they extract most critical work-relevant information about the candidate without wasting time.

Re: Fizzbuzz, Interviews, And Overthinking

#97
post #80
post #43

Earlier quoted context omitted.

If you cannot reverse a string under pressure, you are likely unqualified for the job you are applying for. At least in my job, there is often more pressure than "write a string reverse function in any language you like in 10 minutes."

What a load of bollocks. If your job is to write methods to reverse strings then you are unqualified, otherwise I wouldn't give a shit whether a candidate can reverse a string. Why would I want to know if someone can reverse a string if the job is to maintain a web app? A few questions for you. How old are you? Have you hired developers before? Truthfully, have you ever had to reverse a string under pressure at your…

What questions do you ask your candidates? How many candidates do you go through before making a single offer?

Re: Fizzbuzz, Interviews, And Overthinking

#98
post #85

Earlier quoted context omitted.

Are you kidding? reversing a string in your language of choice is far too trivial. If you can't do it you really aren't ready to be working in the industry.

Out of curiosity, when the interviewer asks you to reverse a string in your language, say Ruby, are you supposed to use existing algorithms/methods built-in in that language, or to flip each character using a for-loop? In Ruby, it's really a single method called reverse will do the trick, i.e., "hello".reverse gives "olleh". I'm trying to make sense of the reason why such a question is asked.

No, the expectation is that you'll use a loop or recursion. If you use an existing method/function, the interviewer will kindly ask you to implement that yourself.

The general reason why such a question is asked is because interviewers don't have an infinite amount of time and there's no point in considering any candidate who can't do this. It's a way to weed out ridiculously bad candidates so that you can focus more on good candidates.

Re: Fizzbuzz, Interviews, And Overthinking

#99

Forget Fizzbuzz, we get candidates that cannot reverse a string (in their language of choice). A friend of mine just told me he uses the question "What is the hex number that comes after 'F'" as his first "weed-out" technical question. It boggles the mind.

Because I tend to get really nervous in interviews and consequently don't interview all that well most of the time, I try to be sensitive to people like me. I prefer to start very simple and sort of gradually increase the pressure until I can find a backing off point.

I haven't observed any correlation between being nervous and underperforming in answering technical questions. How do people get through math exams in college? If anything, I'd expect answers to non-technical questions to be far more influenced by the artificiality and unfamiliarity of the interview situation, being judged by a stranger, high-stakes, and everything.

Re: Fizzbuzz, Interviews, And Overthinking

#100
post #94

Earlier quoted context omitted.

It takes someone who doesn't speak English ten seconds to look up the past tense of the verb "bring" - this doesn't mean you'd want to hire as a journalist someone who seems to think the answer is "bringed" Doing a string reverse is so trivial that it's not about needing that skill, but rather what not being able to do that speaks about the candidate's general aptitude and skill level.

"Why would you test if someone can reverse a string if you're hiring someone to maintain and build on some shitty web app?" If that question can't be answered then your opinion on someones skill level is irrelevant. Also, if you've got time, answer the questions in my first post: "How old are you? Have you hired developers before? Truthfully, have you ever had to reverse a string under pressure at your current job."

String reversal, and all the other common interview questions are simply a microcosm of what a developer does day to day. Programming is about comprehending abstractions and composing them into a greater whole that solves a specified business problem. Reversing a string is exercising those same mental faculties. There is literally no difference between working out the steps to reversing a string and working out the steps to pulling data from a database, transforming it, and displaying it on the screen, except that for the second example one can Google then copy/paste about 90% of it. Asking "reverse a string" type questions will weed out the Google-jockies (obviously there's nothing wrong with Googling for an answer, but if you have to Google for everything you're in the wrong line of work).
Post reply on HN