My Teachers Job Interview Question

Logic Level 4

My maths teacher - who used to work for google - got this interview question. He presented it to us like this:

There are 100 pirates and 100 coins. They're deciding how to split it. This is their system: the lowest ranked pirate proposes they share all the coins equally. The pirates then vote "Ay" or "Nay". If half or more vote "Ay" then the motion is passed. If not then the lowest ranked pirate walks the plank and the second-lowest ranked pirate will propose they share it equally between the remaining 99 of them. This continues until finally a motion is passed. How many pirates will die before they reach a conclusion?

For example: If it were to reach the highest two ranking pirates then the conclusion would be inevitable. The captain - would presumably - vote "Nay" whereas the second ranking pirate would vote "Ay" as he doesn't wish to die. Therefore since a 50% majority vote "Ay" the loot would be divided.

Clarification - All pirates wish to gain as much loot as possible - The captain's vote is not worth more than his crew - The pirates cannot form alliances - The pirates are perfectly logical, but would rather survive than win more gold


The answer is 36.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

Gabriel Chacón
Dec 5, 2018

Consider the following pirate's moods:

  • "I wanna maximize my profit" => mood is greedy green.

  • "I don't wanna die!" => mood is cautious orange.

  • "Guys! Please, be logical!" => mood is desperate red.

  • "I'm dead" => mood is hopeless black.

Let's see how these moods distribute with a growing number of pirates until we find the pattern...

2 pirates: 1 2 \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#20A900}{1}} \fcolorbox{#FFFFFF}{#EC7300}{2} Motion passed!

3 pirates: 1 2 3 \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#20A900}{1}} \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#20A900}{2}} \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#333333}{3}} 1 and 2 can safely play greedy. Last pirate dies.

4 pirates: 1 2 3 4 \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#20A900}{1}} \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#20A900}{2}} \fcolorbox{#FFFFFF}{#EC7300}{3} \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#D61F06}{4}} Pirate 3 h a s has to vote "Ay" and save pirate 4. Otherwise, he dies in the following turn. Motion passed!

5 pirates: 1 2 3 4 5 \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#20A900}{1}} \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#20A900}{2}} \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#20A900}{3}} \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#20A900}{4}} \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#333333}{5}} 1 through 4 can safely play greedy. Last pirate dies.

6 pirates: 1 2 3 4 5 6 \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#20A900}{1}} \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#20A900}{2}} \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#20A900}{3}} \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#20A900}{4}} \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#333333}{5}} \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#333333}{6}} Same situation. 1 through 4 can safely play greedy. 6 dies now and 5 dies in the next turn.

7 pirates: 1 2 3 4 5 6 7 \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#20A900}{1}} \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#20A900}{2}} \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#20A900}{3}} \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#20A900}{4}} \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#333333}{5}} \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#333333}{6}} \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#333333}{7}} Once again, 1 through 4 can safely play greedy. 5 through 7 are doomed and they know it.

8 pirates: 1 2 3 4 5 6 7 8 \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#20A900}{1}} \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#20A900}{2}} \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#20A900}{3}} \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#20A900}{4}} \fcolorbox{#FFFFFF}{#EC7300}{5} \fcolorbox{#FFFFFF}{#EC7300}{6} \fcolorbox{#FFFFFF}{#EC7300}{7} \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#D61F06}{8}} Pirates 5 through 7 h a v e have to vote "Ay" and save pirate 8. Don't forget they are pefectly logical, they know what's coming! Motion passed!

9 pirates: 1 2 3 4 5 6 7 8 9 \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#20A900}{1}} \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#20A900}{2}} \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#20A900}{3}} \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#20A900}{4}} \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#20A900}{5}} \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#20A900}{6}} \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#20A900}{7}} \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#20A900}{8}} \textcolor{#FFFFFF}{\fcolorbox{#FFFFFF}{#333333}{9}} ...

Now you are ready to convince yourself that the following pirates that get their motions passed are 16, 32 and 64. Since the game starts at 100, the first pirate to get his or her motion passed and survive is 64. The remaining 36 \boxed{36} of them (65 to 100) are doomed and they all eventually walk the plank.

Finn C
Nov 30, 2018

As written in the example, if it comes down to 2 pirates it will be split. But will it get that far?

If there were 3 pirates, the first and second would vote "Nay" as they know they would each get 50 coins if the third-ranking pirate walked the plank, as opposed to 33 coins.

If there were 4 pirates the first and second would vote "Nay" as they know they want it to get down to the two of them, but the third-ranking pirate will vote "Ay" as he knows that if the fourth ranking pirate walks the plank, he'll be in the scenario described above. Therefore the motion would be passed, as it says if half the pirates vote yes, nobody walks the plank.

Now THESE four pirates will want it to get down to the four of them so they maximize profit, so another 4 separate pirates (at least 50%) will have to vote in favor of the motion for it to be passed. That brings us to 8 pirates. Then we realize from that point, there will have to be another 8 pirates in order to pass the motion.

Therefore, the powers of two will be the times that the coins are divided.

2 x 2 = 4

2 x 2 x 2 = 8

2 x 2 x 2 x 2 = 16

2 x 2 x 2 x 2 x 2 = 32

2 x 2 x 2 x 2 x 2 x 2 = 64

There are only 100 pirates & 64 x 2 > 100. Therefore, when 64 pirates remain the loot will be divided, and 100 - 64 = 36 pirates die

Do they have to split the loot evenly? Or can some pirates receive more coins than others?

Joshua Lowrance - 2 years, 6 months ago

Log in to reply

They have to split in evenly

Finn C - 2 years, 6 months ago

Log in to reply

Can you then put in a clarification?

Zoe Codrington - 2 years, 6 months ago

Log in to reply

@Zoe Codrington It's currently not letting me edit the problem. Probably a problem with my computer.

Finn C - 2 years, 6 months ago

This is almost similar to the Josephus problem

Vijay Simha - 2 years, 6 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...