Puzzle Interviews

10 Jan 2010

For the past couple of days, I've been pondering how companies go about hiring engineers. I then saw a criticism of the interview brainteaser. I've found a single brainteaser question to be incredibly valuable at getting inside someones head, and I needed to lay out my thoughts.

I understand the contention that the brainteaser problem as a test of intellect is poor. I’m sad to report that I tend to do well with brain teasers because I’ve heard most of the answers before. The ones I haven’t heard tend to be variations on an already-familiar theme.

Still, in the hundreds of hiring interviews I’ve done, I’ve always found myself asking a riddle. I ask the person I’m interviewing to talk through their thinking out loud, and I will give them hints and guidance towards the solution. What’s the point, then?

There are a few habits and abilities that I consider to be prerequisites to competence as a programmer. One of the more important habits is rigorous decomposition of a problem, followed by a systematic attack on the new, smaller problems that have been created. My former business partner, who spent his formative years as a Bain consultant, used to talk about MECE decompositions a lot. MECE is an acronym for “Mutually Exclusive, Comprehensively Exhaustive”. It is another way of saying, ”I’ve broken down everything into a bunch of categories where everything fits in one and only one category.”

Let us consider the classic man-eating alien problem. This problem was originally cannibals and missionaries, but I find the problem much more fun and unlikely to give offense when described as a grouping of three humans and three aliens.

“Three humans and three aliens are trekking through the jungle. The aliens don’t necessarily want to eat the humans, but they find humans so gosh-darn tasty. If at any point the aliens outnumber the humans, they will give in to temptation, and proceed to overwhelm and consume the unlucky humans. The group arrives at a river. The river is both treacherous and long. The only practical way across the river is in a rowboat conveniently left on the bank. The rowboat can only handle two individuals at a time. How does the group get across?”

A good candidate will talk about the possible combinations he or she could send across on the first trip. “I could send across two aliens, a human and an alien, but not two humans.” The candidate would then directly address the possible results of sending across two aliens, a mixed team, and so on. A simple, methodical progression through the possibilities is all I need. I don’t even care if an interviewee gets the answer or not. I just want to watch how that person attacks a problem that can clearly be divided up and defeated in detail.

As a hint, in my experience, any brainteaser that involves crossing something has one out-of-the-box part to it. At some point, you need to send somebody extra back. That is certainly the case with this example. As an exercise when I taught computer science, I would sometimes have the kids solve this problem by sketching out a gigantic bubbles-and-arrows state machine that showed all the potential legal moves, until finally, the real answer emerged.

I pointed a super-fancy algorithm at this to try to automatically find some related posts, and the best it could do was Online Business: DNS, Online Business: Choosing a Domain Name, and Creating a Smoke Animation with Javascript and HTML Canvas.

I have a handy list of all posts available on the blog, and you can find more information about me, and how to contact me, on my front page.

Subscribe

blog comments powered by Disqus