Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

It is still under question—a Programmers.SE question—if competence in solving logic puzzles is a good assessment of programming skills. Nevertheless, they're still used, and chances are high that you will bump into such a question when you decide to change your employer next time.

Mr. Job recommends in a comment to the answer that you should just "study the puzzles, and pass interview". Indeed, there is a plenty of them, and you may have a lot of fun and practice solving them, and you will probably demonstrate (to yourself only, unfortunately) your ability to crack them without any help.

However, I'm not sure how it would help you at an interview.

Assume you've studied a lot of these puzzles, and come to a job interview. The interviewer asks you to solve X, and...you already know how, because you've solved it before. You tell that you've solved this puzzle before, but it does not matter that you've solved it: what counts is that you've seen it, and thus the interviewer can't tell if you're capable to solve it, or just read the solution coined by someone else. He picks another puzzle—and you've seen it before too. And again, and again.

Finally, the interviewer finds a problem you haven't seen: a badly formulated one with quite a stupid and illogical solution (that's why you haven't encountered it during your practice). No wonder you fail to solve it. But the assessment's been already made: you failed to solve a puzzle you were eligible for.

The question is, how should you behave if you like logic puzzles, solve a lot of them (on your own), and encounter them at an interview?

share|improve this question

closed as not constructive by Jim G., thorsten müller, Bart van Ingen Schenau, Jalayn, MichaelT Apr 24 '13 at 13:28

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. If this question can be reworded to fit the rules in the help center, please edit the question.

Make sure to dl and install games.flowix.com/en/index.html in order to practice for the stanford.edu/~laurik/fsmbook/examples/Einstein'sPuzzle.html If you do it in 3 minutes rather than 1 hour, then your IQ will dwarf that of Albert himself. –  Job Apr 14 '11 at 21:11
@Job, I don't find Einstein's puzzle challenging. It's just about enumerating a finite set of potential solutions. What I find more interesting are the puzzles where you should create an algorithm: linked list crunching, prisoners riddles, and those where puzzle masters guess hat colors. –  Pavel Shved Apr 14 '11 at 21:18
Studying logic puzzles you help your intelligence, train to go from unknowns to knowns. Being able to resolve puzzles you have seen, but unable to resolve one that you have not, that's a sign that you didn't study the logic puzzles. You simply memorized them in rot fashion. –  luis.espinal Apr 15 '11 at 2:13
@luis.espinal, this is easy to say when you are on the other side of the interview table. Also, sometimes people get crappy sleep, etc. –  Job Apr 20 '11 at 18:41
@Job - newsflash - I've been on the "receiving/applying" side of the interview table a lot more (a lot more) than on the "asking" side. So my words come from being objective about what it is expected of me when I apply for a job, and for what I'd want should I look to hire someone and pay to get some type of job done. We all get crappy sleep more often than not - specially since we are implicitly expected to always be on top of changing technology. Few of us get a good night sleep before an interview. We might be working a lot of hours while still applying/preparing for a job interview... –  luis.espinal Apr 21 '11 at 10:24

9 Answers 9

While searching for my current job, I had a string of interviews with various companies that all did puzzles in one interview or another. They all used common questions at that. After the first interview I took some time to look up puzzle questions and how to answer them.

When I came to the next interview and the question was one I knew, I commented to the interviewer "Actually, I have seen this question before," and gave the normal answer. The interviewer thanked me for my honesty then said 'so, let's take it a step further then.....' and we looked at the puzzle from another angle. The next question I had seen he asked me a similar question but one that was slightly harder.

So, to answer your question, if the interviewer is on the ball and is actually using these questions as a basis for something other than 'b/c the company told me to ask them,' they can get a lot out of you even if you have seen the questions before. It can show them how you use current knowledge to help you understand a similar problem.

share|improve this answer

Neither. I think studying logic problems is fun, and that's about it.

I think you might be underestimating interviewers. They're often engineers like you and me. When I interview, I don't just ask for the answer, I ask the candidate to discuss it. If they've heard the problem before, I change it around. I ask for a general solution. I ask which constraints are necessary for solvability and which are irrelevant.

If you're a clever candidate, you can try these strategies yourself. The interviewer will be able to figure it out.

EDIT: If a candidate solves a problem without mentioning that he's heard it before, and I asked if they had heard it before, and they say yes ... Bam, interview over. Get out.

share|improve this answer
Would it make a difference if they told you before solving the problem that they'd heard it before? I'm just wondering if it's that they are trying to make familiarity look like problem solving, or is it a bias against them reading logic puzzles in their free time? –  Ethel Evans Apr 15 '11 at 1:58
I edited my answer to be more clear. I have no bias against people who know logic problems. I despise people who mislead for personal gain. –  Brad Apr 15 '11 at 5:09
maybe I'm reading you post wrong, but it looks like a leap of faith to assume that someone misleads you just because he/she doesn't tell you that he/she knows the problem a-prior and while answering the question. He/she might assume that the problem is common knowledge (assuming there is no need to identify the problem), over-eagerness to answer with a solution, etc. I would have never had thought to say "yes, I know this problem from X, the solution is Y" since "Y" should be sufficient. People communicate differently, independent of intention (malicious or otherwise.) –  luis.espinal Apr 22 '11 at 14:24
@luis I mean, I use my judgement. If I say how do you check a linked list for cycles and you say "two pointers advancing at different rates" that's fine, you're not being misleading. But If I ask about an island with 50 blue eyed people, and you pretend to go through the whole process of "solving" it and quickly arrive at the solution, I think that's not someone I want to work with. –  Brad Apr 22 '11 at 15:34
I see, I understand now what you are saying. –  luis.espinal Apr 22 '11 at 15:43

Goals of an interview from an employee perspective: 1. Figure out if I want to work there. 2. Impress them enough to hire you.

Except that usually you first have to impress them to move far enough to have a chance to figure out if you want to work there. Hopefully you have done your homework through networking, google searches, hacking?, targeted resume, to asses the company, but you still need to asses the team, culture, etc.

You could admit that you have seen a bunch of puzzles before and hope that this impresses them.

  • If it does not and you end up failing - you missed out on opportunity to figure out whether you want to work there and impress them enough.
  • If you pretend to solve a puzzle in 5 minutes, and then another one in another 5 minutes, and hopefully move on, you will then have A) Better chance to land a job there, B) A shot at better salary (even if you end up quitting, high salary will help with getting next high salary), C) More time to figure out if you want to work there and interviewers more willing to talk about what is in it for you (and more likely to lie about that).

If they are complete idiots, you can still ask for a 2x your market rate, and either get overpaid, working with retards, or make them feel like they have just let an Einstein slip by because they are underfunded. The later is fun, but does not help you much.

I would still say: "solve those puzzles ASAP and move on with the interview". If you have not seen a puzzle before and it is decent, you might enjoy doing there, unless you have test anxiety.

However, think hard before accepting an offer. There are many crappy employers, but decent ones are out there. After a dozen of interviews something will come up. Hopefully a puzzle is not the only factor/part of the interview process. Better yet if it is a pre-interview screen that you have a bunch of time to work on and submit.

share|improve this answer

I was actually a philosophy major in addition to being a comp sci major. Nothing I like more than being handed a logic puzzle.

I find it funny that schools persist in the belief that it is math and only math that prepares you for a career in comp sci, but businesses obsess over logic problems more even than sample code. I went to a great school for compsci and philosophy, and the compsci logic courses were a complete joke...Even though programming is one of the only practical applications of deductive logic, it's not treated seriously.

I think on some level that this is recognized: that it is understood that you must be able to reason deductively at a high level to be a good programmer, and that is the reason people focus on the logic puzzles. Asking someone to iterate a linked list on a whiteboard is all well and good, but it just tells you that they can complete a routine technical task, not that they can reason.

share|improve this answer

I will answer the puzzles, whether I had seen them before or not.

Only if asked by the interviewer if I have seen the puzzle before would I tell them.

As far as something like this is concerned, an interviewer should be prepared for candidates that have seen his puzzles before and adjust accordingly.

Frankly, if this (and only this) is what is used to asses my programming skills, I'd rather not work there.

share|improve this answer

If you're studying logic puzzles to prepare for the interview, you wouldn't normally volunteer that you'd seen the puzzle (or one generally similar), you'd simply present the solution and let the interviewer assume that you were coming up with the solution on the spot.

If you just happen to enjoy these sorts of puzzles, on the other hand, and you're uncomfortable implying to the interviewer that you're solving a problem on the spot, it's much more likely that if you say you already knew the answer to the first couple of problems that you'd end up with a problem that strikes you initially as new but then you realize can be transformed into a problem that you have seen before. In that case, it strikes me as perfectly reasonable to present that as your solution just as you would prove that something is NP complete by showing how it reduces to a problem that has already been proved NP complete rather than actually showing that the problem itself is NP complete.

share|improve this answer
I disagree with the top paragraph. I've always stated when I've seen a problem before, then solved it. My honesty has always been appreciated by my interviewers. Any studious engineer will be familiar with some of the common questions. –  Ethel Evans Apr 15 '11 at 2:01
@Ethel - I'm not stating that misleading the interviewer is a good thing and I certainly don't recommend it. But if you're taking the advice to study for an interview by reviewing logic puzzles, the normal assumption is that you're not immediately divulging the fact that you knew the answer already. If you believe that logic puzzles are pointless hurdles to getting a job, folks like Job would generally suggest that it's no different than brushing up on some syntax in case it comes up in the interview and thus not something that needs to be disclosed. –  Justin Cave Apr 15 '11 at 2:08
When you solve problems intended to gauge problem-solving skills (like logic puzzles) using memorization skills (which are always used for syntax), you are not giving the interviewer the information about yourself that they think they are getting. Also, the interviewers should also be asking you for your thought process, which is difficult to honestly share without revealing that you saw the puzzle before. Finally - why not reveal it? This shows that you retain solutions to problems and can reuse them instead of re-inventing the wheel. That's a Good Thing. –  Ethel Evans Apr 18 '11 at 19:46
@Ethyl - I'm not disagreeing with you and I'm not advocating that people study logic puzzles for an interview or that they try to deceive the interviewer. I am stating that when someone (like Job) advocates studying logic puzzles to prep for an interview, the intention is generally that the interviewee then has a head start if a similar problem is asked and that the interviewee not disclose that head start. In that mindset, it's no different than studying graph algorithms prior to an interview and then reciting the min flow algorithm if it happens to come up. –  Justin Cave Apr 18 '11 at 20:02

as with everything, all you learn you may have some kind indirect or direct use so I don't think learning puzzles is a bad thing. That said, knowing how to solve puzzles seems rather questionable if it has broad use in "normal" programming. In an interview focus is often on other things, like if the candidate can actually program, has he/she the right can-do attitude and wants to learn, can he communicate clearly and so on. puzzle solving seem more like a curiosity than a necessity in a candidate.

share|improve this answer

Unfortunately, this puzzle solving type of interviews started because of one man's obsession with puzzles Typically, some interviewers stick to language agnostic questions dealing with algorithm and data structures, but some go a step ahead and ask these class of questions. There might be some truth to the argument that logic puzzles test an engineer's ability to deduce solutions to new problems, but it is a totally different fact that when it comes to real work, all they have is maintaining code written by the cheapest vendor.

If the interviewer pick one from a pile of puzzles, and without understanding the reason but only tries to compare answers, the best you could do is to attempt to solve it. Preparation definitely helps. When you encounter a puzzle you have solved before, I do not know if you should act as if you are solving then, or you should admit that you know the puzzles (as another answer points out.) The other option probably is to ignore these, and stick to technical questions, and tell them that though you will attempt the question, you do not believe that it truly reflects your strengths.

share|improve this answer

If you study logic puzzles correctly (instead of memorizing them in rot fashion), then they should help you in problem solving, reasoning and deductive logic (skills that have application in any type of work requiring analysis.)

Whether they help you with a particular interview, that's an open question as every interview is different (not counting any agendas brought to the table by the interviewer.)

They will certainly not help you if you treat them as square pegs to be pushed in whatever hole is presented to you, or if you try to use them in cookie cutter fashion.

Speaking of which, if you haven't read "Mocking a Mocking Bird", you should.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.