You are a startup looking to hire one "full-stack engineer".

You want a mix of 3 skills:

Tom, Harry & Sally show up to your whiteboard programming interview.

Lemme first ask you - Why do you even have an interview ?

You say - What sort of a rubbish question is that ? I have 3 candidates and only 1 spot. So I have an interview. That lets me rank the 3 candidates. The candidate on top gets the spot.

I say - Fair enough. So you believe the input to this "interview function" is a set of candidates. The output of this interview function is some monotonic ranking based on their skills & performance at this interview. You then pick off the person with highest rank. Such a monotonic ranking always exists ?

You say - Of course! Why the hell am I invoking this "interview function" if the output is going to be gibberish ? Obviously such a ranking exists

.

You want a mix of 3 skills:

- front-end (JS/CSS/HTML),
- back-end (Python-Django),
- data-analysis (postgres, Python-pandas)

Tom, Harry & Sally show up to your whiteboard programming interview.

Lemme first ask you - Why do you even have an interview ?

You say - What sort of a rubbish question is that ? I have 3 candidates and only 1 spot. So I have an interview. That lets me rank the 3 candidates. The candidate on top gets the spot.

I say - Fair enough. So you believe the input to this "interview function" is a set of candidates. The output of this interview function is some monotonic ranking based on their skills & performance at this interview. You then pick off the person with highest rank. Such a monotonic ranking always exists ?

You say - Of course! Why the hell am I invoking this "interview function" if the output is going to be gibberish ? Obviously such a ranking exists

.

OK, lets assume each of these candidates has each of these 3 front-end, back-end and data-analysis skills, with expertise on a 7-point scale. So Tom might be a (1,4,7), Harry is (3,3,6) and Sally equals (2,5,5).

All we've done so far is model each candidate as a 3-sided die, with upto 7 pips on each face of the die.

So let's roll the dice!

Tom vs Harry! Who's the better candidate ?

Well,

Tom = (1,4,7)

Harry = (3,3,6)

You have 9 combinations (1,3), (1,3),(1,6),(4,3),(4,3),(4,6),(7,3),(7,3),(7,6)

Of these, Tom beats Harry on: (4,3),(4,3),(7,3),(7,3),(7,6) = 5 occasions.

So, chances that Tom beats Harry: 5/9

Straightforward, high-school math. No surprises.

So let's roll the dice!

Harry vs Sally! Who's the better candidate ?

Well,

Harry = (3,3,6)

Sally = (2,5,5)

Once again, 9 combinations.

Of these, Harry beats Sally on: (3,2),(3,2),(6,2),(6,5),(6,5) = 5 occasions.

Probability that Harry beats Sally: 5/9

Straightforward, high-school math. No surprises.

So let's roll the dice!

WHY ? Aren't we all done ?

Tom beats Harry & Harry beats Sally.

That means we have a monotonic ranking.

Tom > Harry > Sally.

We hire Tom.

All done. Go home, Harry & Sally & the rest of you reading this blog.

Wait a minute, I plead with you. Just indulge me one more roll.

Well, OK.

Lets roll the dice!

Sally vs Tom! Who's the better candidate ?

Well,

Sally = (2,5,5)

Tom = (1,4,7)

You have 9 combinations.

Sally beats Tom on: (2,1),(5,1),(5,4),(5,1),(5,4) = 5 occasions.

So, chances that Sally beats Tom: 5/9

Straightforward, high-school math. No surprises.

What the flying fuck?!

**What just happened ?!!!**

Tom beats Harry who beats Sally who beats Tom ?! Then who's the best candidate ? You go back and double-check the math, but its sound, I assure you. This is plain and simple high school arithmetic, so dumb even I can't fuck up. So now you are looking for a desperate explanation. Maybe I've come up with what the programmers call an "edge case" ? So called "pathological example" ? Maybe there's only one such Tom & Harry & Sally in the real world ??

Oh, I assure you. I can find as many as you want.

How about

Tom = (1,5,6)

Harry =(3,5,4)

Sally =(3,7,2)

Again, Tom beats Harry beats Sally beats Tom 5/9 !

or,

Tom = (2,7,3)

Harry =(6,5,1)

Sally =(5,3,4)

Yet again, Tom beats Harry beats Sally beats Tom 5/9 !!

Heck, I'll even thrown in some Scala code for free that generates all these Toms & Harrys & Sallys.

Lest you think I have split the atom or discovered something new and unobvious, let me assure you, I honestly wish it were so :( Alas, non-transitive dice are a well-known curiosity in math and finance circles. Warren Buffet once attempted to trick Bill Gates into rolling a pair of them! Dr. Efron, the inventor of the Bootstrap, also invented Efron' dice, perhaps one of the most famous examples of non-transitive dice. So did physicist Michael Winkelman, puzzle-maker Oscar Van Deventer, James Grime, and a host of others. In fact, it is fairly trivial to adapt the above Scala code to find your own non-transitive dice - imagine you have five candidates with programming skills on a standard 10-point scale. Find candidates such that A beats B beats C beats D beats E beats A with identical probability. They exist, I assure you!

So the next time you summon a bunch of unsuspecting candidates to a whiteboard programming interview, think about this - You've just been utterly confounded by a simple pair of dice with well-known mathematical properties. What chances do you have against real live human beings, with hundreds of temporally varying skills, both numeric and qualitative, over a wide continuous scale ? Perhaps a little humility is in order.