News for hackers. Stuff that matters.
Re:Why we don't hire programmers based on puzzles and tricks by potatolicious on Friday February 22, 2013 @09:48AM (#5264381)
Damn right. Even worse than whiteboarding random algorithms are logic puzzles.

I can sort of see how implementing my own hash table fits into a dev job, but I why manhole covers are round, or light bulbs in a room has absolutely nothing to do with anything relevant in our field.

People who use logic puzzles as proxies for anything in an interview have my everlasting scorn.

Re:Why we don't hire programmers based on puzzles and tricks by AdamTReineke on Friday February 22, 2013 @11:20AM (#5265016)
My all-time favorite interview was one when I was interviewing for an SDET intern position at Microsoft. That interview (one in a day of four interviews) featured a great progression: logic puzzle, code the fixed input solution, code the n input solution, test your solution.

The puzzle was (apologies to the interviewer, but it IS a common puzzle) the eight ball and balance problem, where one ball is heavier than the other seven and you need to use a balance scale to find the lightest of the balls in the minimum number of weighs. I'd heard of the puzzle but never worked it out. I initially jumped to the 3 weigh solution, but the interviewer challenged me to keep looking, so I kept thinking and I found the 2 weigh solution. He then asked me to write code that could solve the 8 ball problem. Pretty straightforward. Once I finished that, he had me adopt it to be able to handle [edit: any number of] balls. This tested my ability to abstract my code. Finally, he asked how I would go about testing the program and we talked through that.

I cannot wait to steal that progression when I end up doing technical interviews someday.

Re:Why we don't hire programmers based on puzzles and tricks by Jabbles on Friday February 22, 2013 @11:46AM (#5265151)
Anyone who's studied information theory would destroy that puzzle though. In the same way that someone with a physics degree would perform way above average on a "count the stars" question. Or someone whose dissertation was on computational biology would excel at a string-matching algorithm question.

It is an example of the interviewer (or company/process) mistaking a specific problem as representative of all problems. Presumably they're looking for someone with "general problem solving skills", rather than "knowledge of astrophysics".

Re:Why we don't hire programmers based on puzzles and tricks by pseut on Friday February 22, 2013 @12:21PM (#5265334)
You can interpret the response more broadly, though. In this case, it was probably pretty apparent that the person hadn't worked through the problem before, so it is indicative of problem-solving and attitude. If he'd recited the answer from memory that usually comes across and then you have to pick something from a different area. If, as an interviewer, you literally can't find a problem that the interviewee hasn't already thought about, (i.e., he or she knows about computational biology, astrophysics, information theory, etc and none of this was obvious from their resume and previous positions) that can also be a good sign.
Re:Why we don't hire programmers based on puzzles and tricks by achompas on Friday February 22, 2013 @03:26PM (#5266554)
It's easy to game your answer as an interviewee though. HN actually had a post a while back about someone who "interviewed" for a living while on unemployment; by the time he was done, he had mastered pretending to think deeply about the answer to any interviewing question.
Re:Why we don't hire programmers based on puzzles and tricks by pseut on Friday February 22, 2013 @04:23PM (#5266934)
It's possible, but I doubt it's easy. I assume that the "mastery" of thinking deeply about answering interview questions was self-reported, right? I'd be curious to know how many of the interviewers would agree with him about it.

This is something that's pretty easy to test out in practice interviews with friends. My experience is that it's a lot easier to come up with questions that require thought and insight to answer than it is to answer them.

Re:Why we don't hire programmers based on puzzles and tricks by dragonwriter on Tuesday February 26, 2013 @12:08PM (#5286833)
> Anyone who's studied information theory would destroy that puzzle though. In the same way that someone with a physics degree would perform way above average on a "count the stars" question. Or someone whose dissertation was on computational biology would excel at a string-matching algorithm question.

And...all of this is information the interview panel typically has available when evaluating candidates, as well as the result of any exercises done as part of the interview.

> It is an example of the interviewer (or company/process) mistaking a specific problem as representative of all problems. Presumably they're looking for someone with "general problem solving skills", rather than "knowledge of astrophysics".

If the process uses just one and not a set of exercises spread across problem domains, and gives it a fixed weight in the evaluation process and considers it independently of the candidates resume, the rest of the interview, etc., treating each component orthogonally rather than evaluating them together holistically, that might be true.

But that's not a problem with the puzzle as a tool, that's a problem with how the tool is used.

Re:Why we don't hire programmers based on puzzles and tricks by achompas on Friday February 22, 2013 @03:12PM (#5266471)
Anyone who's studied information theory would destroy that puzzle though.

I understand this comment in a general sense--the scale's behavior represents two possible states, so you can use it to filter the answer space in O(log_2 N) ala binary search, and you can get away with O[(log_2 N) - 1] if you partition the answer space the right way.

But what's the information theoretic interpretation of the problem?

Re:Why we don't hire programmers based on puzzles and tricks by mturmon on Friday February 22, 2013 @03:38PM (#5266620)
It is a source coding problem. Kind of like a Huffman code. Depending on how theoretical or applied your information theory coursework was, you might have worked out simple codes like these in class, and that might be an advantage.

It's actually very similar to your tree reasoning above. The information theoretic outlook uses the probabilities of each of the N states to make a more efficient code, but since there are no probabilities in this case, the two approaches pretty much coincide.

Incidentally, there are three possibilities with each weighing -- scale tips right, scale tips left, scale stays balanced. So your logs should be base 3. In coding language, you are transmitting ternary valued symbols.

And, you should dispense with the O() notation, because the lead constant matters very much in this puzzle, and it happens to be 1.

Re:Why we don't hire programmers based on puzzles and tricks by achompas on Friday February 22, 2013 @03:54PM (#5266722)
Thanks! Haven't taken a formal information theory class yet, but I'd like to soon.
Re:Why we don't hire programmers based on puzzles and tricks by mturmon on Friday February 22, 2013 @08:46PM (#5268135)
If you are mathematically inclined and good with probability, it could be a lot of fun.
Re:Why we don't hire programmers based on puzzles and tricks by rohamg on Friday February 22, 2013 @12:21PM (#5265338)
Everyone from McKinsey to Accenture makes the same mistake.
Re:Why we don't hire programmers based on puzzles and tricks by GhotiFish on Friday February 22, 2013 @03:09PM (#5266452)
I got to say, interview puzzles, while hated by the jobless, are lots of fun to think about. That sounds like a fun interview.
Re:Why we don't hire programmers based on puzzles and tricks by msluyter on Friday February 22, 2013 @11:17AM (#5264986)
Re: hash table. I've been asking candidates to basically implement HashMap (for java positions) (without simply using Hashtable). It's an ongoing experiment. Although I've been told that this is a common question, I've actually never seen anyone do very well at it, and I have mixed feelings about it.

On the one hand, it gets at some important java concepts: hashCode() and equals() and the relationship between them. Depending on how they go about it, you can also get into issues of runtime complexity, memory/speed tradeoffs, etc... It's a deep question that offers a lot of room for exploration.

On the other hand, as mentioned, people usually do fairly poorly at it, and so my fear is that it's simply too difficult. I mean, I'd even be satisfied with solutions storing key/value pairs in a list -- inefficient, but workable -- but it's fairly rare that folks even get that close.

Re:Why we don't hire programmers based on puzzles and tricks by danielweber on Friday February 22, 2013 @11:25AM (#5265046)
The point of any question isn't whether they get it right or wrong. The point is how they work through it.

I've been perfectly happy with people who didn't get the "right" answer to some question.

Re:Why we don't hire programmers based on puzzles and tricks by smackfu on Friday February 22, 2013 @12:19PM (#5265324)
I would be surprised if many people knew hashing algorithms at all.
Re:Why we don't hire programmers based on puzzles and tricks by msluyter on Friday February 22, 2013 @12:28PM (#5265372)
To clarify, you don't need to implement a hashing algorithm for this question. (Using hashCode() suffices). And you don't even have to implement a hash table. As I mentioned, a working linked list of key/values would probably be an above average answer, if it came with the understanding of the big-O performance characteristics.
Re:Why we don't hire programmers based on puzzles and tricks by nonamegiven on Friday February 22, 2013 @10:29AM (#5264630)
My current job, they asked me one of those. I pretended to think about it for about 15 seconds, then asked for the answer (it had an answer).

The guy said "You want me to tell you?" I said "yeah."

I've been here a year.

Re:Why we don't hire programmers based on puzzles and tricks by nazgulnarsil on Friday February 22, 2013 @05:36PM (#5267354)
the ability to just go with the already existing answer rather than constantly working everything out from scratch is quite an underrated skill IMO.
Re:Why we don't hire programmers based on puzzles and tricks by misiti3780 on Friday February 22, 2013 @10:31AM (#5264642)
haha
Re:Why we don't hire programmers based on puzzles and tricks by krutulis on Friday February 22, 2013 @11:14AM (#5264966)
If the motive is laziness or the objective is to trick or intimidate a candidate, then I agree that the method deserves scorn. But I disagree with your position the technique is never reasonable. I like to hire people who know more than I do, and in this circumstance puzzles occasionally help learn about a person.

As a candidate I'm not particularly good at solving puzzles in this kind of situation, but I'm not bothered when people present them because the discussion and interaction about the puzzle matters more to me than getting the answer.

As an interviewer it is important to ask questions that a candidate cannot answer to see how they react. Since I'm a slow thinker myself, I must sometimes resort to "unfair" questions. I don't expect an answer, I expect a reaction.

After establishing a friendly rapport, finding common technical background, presenting an "unfair" puzzle, and discussing the puzzle a bit, then a discussion like this is golden:

Candidate: "Do you believe my ability to solve this puzzle indicates how well I could do this job?" Me: "No. Though I often enjoy puzzles, I'm not particularly quick with them myself." Candidate: "Then why ask a question like this?" Me: "Because I want to see how you react when you don't know an answer right away. In your case, I had to resort to tricks."

Re:Why we don't hire programmers based on puzzles and tricks by derefr on Friday February 22, 2013 @12:41PM (#5265454)
> As an interviewer it is important to ask questions that a candidate cannot answer to see how they react.

In the context of an interview, that would just make me horribly frustrated--because my default response to not knowing the answer to a question, nor even being able to perceive a method to resolving my ignorance, is to go out and research the problem.

Whether on the Internet, or by asking my coworkers, or finding an expert, or just running actual experiments and seeing a pattern in the large pile of data generated, this is usually "the" way to get a problem solved, and what I spend nearly 80% of each working day doing.

I don't rely on "sudden gusts of inspiration blowing through me" to solve problems, because the time that could take to happen is unbounded, and it can't be made to scale, unlike research, which can be delegated as you please.

But obviously, research is a tool entirely taken away from you in an interview. The only thing you can do to find out more about the problem is to ask the interviewer themselves--at which point you're basically playing a game of 20 questions, where instead of getting all the data you'd realistically expect in response to each query, you get dealt out precise quantities of informational entropy to string you along.

This contrived situation is not one that applies to the average day in the workplace, and being made annoyed by it is no useful measure of how one reacts to real non-obvious problems.

Re:Why we don't hire programmers based on puzzles and tricks by krutulis on Friday February 22, 2013 @01:35PM (#5265772)
Answering "In the context of an interview, [I get] frustrated because my default response to not knowing the answer to a question ... is to go out and research the problem [and I cannot do that in an interview]" is a nice response to not knowing an answer and would get bonus points for honesty and self-awareness.

The best candidates will recognize and comment on the ways in which frustration can be either constructive or destructive.

"This contrived situation is not one that applies to the average day in the workplace," is a serious over-generalization. Enormous amounts of code are written based on contrived beliefs about the way business does or should operate. The world would be much better off if programmers were better at recognizing and constructively commenting on these artificialities.

Re:Why we don't hire programmers based on puzzles and tricks by tensor on Friday February 22, 2013 @04:36PM (#5267019)
I personally think that "I would go out and research the problem" is the best answer. Introspection about response to feeling sounds like a huge waste of time and something best suited for people's psychiatrist.
Re:Why we don't hire programmers based on puzzles and tricks by tiziano88 on Friday February 22, 2013 @09:51AM (#5264404)
I think that question about why manhole covers are round is more of a urban legend than anything else. Or it might be a question asked to someone applying for a non-technical role, to see how they reason about the issue (though it is most definitely not the best question to achieve so).
Re:Why we don't hire programmers based on puzzles and tricks by ghurlman on Friday February 22, 2013 @10:49AM (#5264769)
I was asked that question during an interview for a technical role at Microsoft. Granted, it was 13 years ago at this point, but they did really ask stuff like that, and probably still do.
Re:Why we don't hire programmers based on puzzles and tricks by AdamTReineke on Friday February 22, 2013 @11:08AM (#5264923)
I haven't heard of those silly questions in the intern interview circuit. (2 at-school, 4 on campus)
Re:Why we don't hire programmers based on puzzles and tricks by potatolicious on Friday February 22, 2013 @11:21AM (#5265019)
My impression is that they are no longer in vogue - for a few years when I was in college (2004-ish) they were all over the place. Our industry is extremely faddish, even when it comes to interviewing...

You can still see them in some places I believe. I've heard anecdotally that Microsoft is still a fan of them.

Re:Why we don't hire programmers based on puzzles and tricks by BenOfTomorrow on Friday February 22, 2013 @04:36PM (#5267017)
When I was trained as an interviewer at Microsoft (circa 2006), they explicitly warned people against asking questions like that (and had been doing so for some time). There may be older employees who stubbornly persist, though.

I should add that my personal experience contrasts with yours - I did a lot of interviews around 2004 and got asked riddle-type questions by one, maybe two, people. My memory is that they mostly died with the original dot-com boom.

Re:Why we don't hire programmers based on puzzles and tricks by jkimmel on Friday February 22, 2013 @09:57AM (#5264435)
Entirely an informational note, but the manhole-covers question actually originated at Microsoft if I recall correctly. There are several references to it around the web, and at least one primary source confirmation by an interviewer that he used the question on multiple occasions [1].

That said, the fact that it was first introduced by a highly successful company doesn't lend it any merit in my book.

[1] http://blogs.msdn.com/b/bgroth/archive/2004/09/27/235071.asp...

Re:Why we don't hire programmers based on puzzles and tricks by rallison on Friday February 22, 2013 @10:02AM (#5264475)
Anecdotal, yes, but I have actually been asked the manhole cover question in an interview. Even if it started out as an urban legend, it does appear to be in use in the wild now.
Re:Why we don't hire programmers based on puzzles and tricks by Aloisius on Friday February 22, 2013 @07:03PM (#5267794)
The question never made any sense. Lots of manhole covers are rectangular. As long as the lip of the manhole is round and small enough, it still won't fall through.
Re:Why we don't hire programmers based on puzzles and tricks by jchung on Friday February 22, 2013 @12:40PM (#5265446)
Whenever I drill manholes, I always drill them square.
Re:Why we don't hire programmers based on puzzles and tricks by stcredzero on Friday February 22, 2013 @12:47PM (#5265484)
It is possible, but probably too expensive for you to buy.

www.youtube.com/watch?v=ALiqAXiTQBg

Re:Why we don't hire programmers based on puzzles and tricks by ig1 on Friday February 22, 2013 @11:10AM (#5264938)
Logic puzzle as the name implies are puzzles that can be solved using logic; typically deduction which neither of your given problems are.

It's important to make this distinction because skills like deduction are actually critical to developers, i.e. identifying the source of buggy behaviour.

Re:Why we don't hire programmers based on puzzles and tricks by hkmurakami on Friday February 22, 2013 @10:13AM (#5264534)
Logic puzzles test how much the candidate prepared for logic puzzles. It implicitly tests how much the candidate "wants the job", but it also has the effect of turning away the stars who have options. As the best continue to have more and more options available to them where the team members understand that this kind of interviewing is counterproductive, companies that continue to use puzzles will end up with candidates that need them, instead of the candidates that they need.
Re:Why we don't hire programmers based on puzzles and tricks by qu4z-2 on Monday February 25, 2013 @12:27AM (#5277458)
I dunno. I enjoy solving puzzles.

Maybe I'm not a star :)

Re:Why we don't hire programmers based on puzzles and tricks by smoyer on Friday February 22, 2013 @09:51AM (#5264397)
Logic puzzles are definitely useful ... how else can the interviewer feel superior (after all, he/she already knows the answer and has probably forgotten how they came by that answer).
Re:Why we don't hire programmers based on puzzles and tricks by rdtsc on Friday February 22, 2013 @09:56AM (#5264426)
If I was given a logic puzzle I would ask them "so how many times in the last year this company had to solve this particular puzzle here?".
Re:Why we don't hire programmers based on puzzles and tricks by mark-r on Saturday February 23, 2013 @01:52AM (#5268824)
And you would have gotten an instant fail on the "cultural fit" criteria.
Re:Why we don't hire programmers based on puzzles and tricks by rdtsc on Saturday February 23, 2013 @02:39AM (#5268905)
Good!
Re:Why we don't hire programmers based on puzzles and tricks by mark-r on Saturday February 23, 2013 @05:14PM (#5271729)
Just as a logic puzzle might be a bad predictor of how you'll perform on the job, it's probably also a bad predictor of the quality of the company doing the asking.
Re:Why we don't hire programmers based on puzzles and tricks by bearmf on Friday February 22, 2013 @11:14AM (#5264965)
I really don't understand why manhole covers or stars in the universe puzzles are considered "logic puzzles". Logic questions are not of the form "why?" and "how?". Their structure boils down to "is this statement true or not?"
Re:Why we don't hire programmers based on puzzles and tricks by antoko on Friday February 22, 2013 @12:03PM (#5265243)
It is a poor choice of word. I'd suggest the reason for calling them "logic" is that the process by which you explain what you're thinking and why to the interview gives them an insight into your ability to use logic. The puzzles themselves are categorically NOT logic puzzles.
Re:Why we don't hire programmers based on puzzles and tricks by bearmf on Friday February 22, 2013 @02:24PM (#5266150)
Yes, you need a little logic. But for those puzzles it is (arguably more) important to know some key facts about the world which form a basis for your reasoning. I don't know, maybe reasoning based on wrong facts will satisfy some interviewers. Say, I can assume that half the stars in the universe are visible from earth and that there is only one galaxy and reason from that. The basis is clearly false, but I will be able to show off my "logic".