Wednesday, January 4, 2012

Interview questions - some ideas and why they are helpful

I have been away on vacation and I got some time to read, so I dug in to Black Swan by Nassim Nicholas Taleb.  He is an excellent and thought provoking writer.  I am reading this book extra slowly as I like to stop after every page or so and think about what he has written.

In the book he poses some interesting questions and I think some of them may be interesting to use as interview questions.  So that I don't leave you in suspense I will put the questions here and allow you to think about them while I give an further introduction to what I want to achieve, which is not necessarily the point that Taleb was making.

A) If you had no restrictions on folding a piece of paper and could physically fold it 50 times.  How tall approximately would the folded paper be?

B) Given the number sequence 2,4,6.  Find the rule that determines the sequence.  You give three three number sequences that I will answer yes or no to if then conform to the rule of the sequence.

C) If I flipped a fair coin 100 times and it came up with 99 heads, what is the probability that the next flip will be tails?

I have talked before about stupid interviews that waste my time as well as the time of the employees of the company that has been interviewing me.  I should note that I have been asked interesting questions and puzzles in some interviews and one or two silly ones too.  The one that springs to mind here is when I got asked if I could have any superpower what would it be.  If you are an interviewer asking that question be damn sure you have a good interpretation of the responses to this question.  Some people, even geeks, are just not in to comics and superheroes.  My answer to that question was that it is very hard to give an answer that couldn't be sinister.  Flying is probably pretty harmless, but mind reading/ control, invisibility, super strength are all things that could be used for bad just as easily as for good.  I didn't think it was a good question, but I tried to answer it as best as I answer good questions, by showing that it was flawed.  I then asked the interviewer the same question.  He gave me an unsatisfactory answer.  I should have asked him how he interpreted my answer, I don't think it made any difference to the result of the interview.  I will concede here that if the future employer is a huge comic book fan as are the team that the position is for, then it may be a useful tool for assessing how good a fit it will be for the future employee.

Additionally mathematical and logic puzzles may not give the best metrics for good employees when used incorrectly.  Know what you want to get out of the answers, it is not good enough to find a question on the internet and ask it hoping to determine that the answer will give and indication of whether the potential employee is capable of thinking outside the box or has above average logical reasoning skills.

Looking at the questions in a little more detail:

A) Firstly the answer I don't want to hear is that a piece of paper no matter what the size cannot be folded more than 7 times (This is the current accepted number for a regular piece of paper, though apparently a girl managed 12 times and came up with and equation to prove it).  I am not testing knowledge, and no one likes a smart ass.  Additionally I asked the question stating there were no physical restrictions.   

I want to see the reasoning and thought process.  First state your assumptions.  A piece of regular printer paper is clearly not 1cm thick.  I would accept the candidate making the assumption 1mm, though that is a factor of 10 out.  It is much closer to 0.1mm, however I am not testing knowledge here just reasoning.  Lets assume it is 1mm we can always divide by 10 to get the real answer later.  It should be fairly clear that the answer is 50^2 * thickness.  I do not expect the exact answer here.  But I would like an order of scale.  I have a short cut.  10^2 is 1024.  So for every ten folds the height of the paper goes up by a factor of 1000, this means that the answer is 10^15 times the thickness. If the thickness is 1mm then the length is approximately 1,000,000,000 km. The real answer given the actual thickness is 100,000,000km, about two thirds the way from hear to the sun.  

I have a confession, I am horrible at mental arithmetic.  I could train myself to be better at it, but I guess I just got lazy.  If I need to add something up accurately I usually have a computer, calculator or even a pen and paper handy.  What I am good at is estimating.  This is phenomenally powerful.  The ability to this well and accurately enough can be more useful than just plugging the numbers into a calculator.  If I look at some calculation and estimate the answer first, it is easy to see errors if I make a mistake when plugging the actual numbers into a computation device.  I attribute this lesson to Mr Roger Hand my A-level physics teacher, thank you so much for this it has been an invaluable tool throughout my life.  

I like to know the scale of big numbers.  It puts things in perspective, it is not the most important thing here but you can expand on the estimation aspect by equating a large number with something that it represents.  100 million km really doesn't mean that much to me.  The distance to the moon is 400 thousand km, so it is considerably more than that and as I said two thirds the distance to the sun.  If someone said its about the distance to the sun, then that would be satisfactory.  It's about the right order of magnitude.

Enough about estimation.  The other skill this highlights is knowledge and understanding of powers of two.  I honestly wouldn't care if the candidate had to write down the powers of two, as long as they stopped at 10. It should be obvious at that point how to short cut to the answer from there.

I will highlight why these two things are necessary for a candidate that I would employ.  We deal with large numbers.  Millions and tens of millions of dollars.  We multiply that by fractions of pennies.  If we are producing results that are factors of 10 out is should be obvious from an estimate done before that calculation.  This is pretty critical as we are talking about real money transactions and position management.  The powers of two should be second nature to any Computer Science graduate.  We recently had to send out messages to a system in byte codes.  I spent far too much of my time explaining the binary, decimal and Hex representations of these strings to my employee.  It was immensely frustrating for both of us, but we got through it.  In a world of high level languages, it is too easy to forget the roots of computing lies in bits and bytes.

B) What three sequences did you think of?  1,3,5; 8,10,12; 20,22,24.  The answers would be yes, yes and yes.  Your conclusion would be increments of 2.  You would be wrong.  That answer is clearly a possibility but not what I was looking for.  You may argue that it fits your sequences.  Of course so does the correct answer.  You may get defensive, and say how was I supposed to determine that.  To which I would answer that you must try to find a sequence that doesn't fit.  Using the following 3 sequences: 1,3,5; 5,10,15; 6,5,3, would result in yes, yes and no.  1,3,5 confirms your initial assumption that the number increment by 2.  5,12,15 disproves that the increments must be 2 and that they must be regular. Finally 6,5,3 shows that the sequence cannot be descending.  The answer is that the sequence must be ascending, and that is all.  

It can only be shown by finding counter examples as well as examples.  If you just go about proving yourself right with each suggestion you will get locked in a corner.  A candidate able to simply solve this should be good a bug testing.  A successful bug test is one that fails, any other bug test does not show evidence of a bug.  This must not be confused with show evidence of no bugs.  A semantic difference for sure, but a very important one.

C)  This takes me back to school.  The concept of a fair coin and a fair die.  That means that it is not unfairly weighted, there is no bias.  It should conform to probability.  Of course if the question was I flipped a fair coin 5 times and it was heads.  The probability of a tail would reasonably still be 50%.  I would not expect anything else.  However as the numbers grow the statistics should tend towards conforming to the true probabilities.  I would reasonably expect around 60/40 one way or another for 100 tosses and maybe 55/45 for 1000 flips.  To have 99 out of 99 flips come up the same, you would be a little foolish to assume that I was telling the truth about it being a fair coin.  So OK, its a trick question of sorts, but it is more of a real world problem.  I have been told something, but I have evidence to prove otherwise, now I must draw a reasonable conclusion.  I am not trying to trick you, I am trying to get you to solve a problem of two conflicting bits of information.  I want to here that it should be 50/50 if its a fair coin, but it doesn't seem to be a fair coin.  Equally I do not want to hear that it's clearly going to be a 100th head.  You would have ignored my statement that its a fair coin, and assumed that just because something has happened one way 99 times in a row then it is going to be the same on the 100th time.

Here we see that that real world problems do not always fit into classroom style examples.  The world fits the normal distribution less than we think it does.  It also gives an example of how probability and statistics fit together.  A reasonable candidate should understand and show this in their discussion of the question.

I hope this has given and potential interviewers some ideas on what to ask and how to understand the answers they get.  Please comment and let me know what you think about this, and if you have any other suggestions.

No comments:

Post a Comment