RockYou Interview Question: Given 5 pirates on a ship, th... | Glassdoor.co.in

Interview Question

Software Developer Position Interview Redwood City, CA (US)

Given 5 pirates on a ship, they need to distribute a pot of

  gold that has 100 gold pieces inside of it. The first pirate must make a proposal of how the gold will be distributed. If he receives over 50% votes from the remaining pirates, then his proposal will be accepted and the gold will be distributed. If he receives less then 50% support, then he will be thrown off the ship and die.
Tags:
brain teaser interview question
Answer

Interview Answer

42 Answers

6

The answer is for the first pirate to offer the 3rd and 5th pirates 1 gold each, and then take the remaining gold for himself. Otherwise the 3rd and 5th will probably not receive any gold.

Interview Candidate on 10-Feb-2010
2

this is an extremely subjective question. first the nature of the pirates must be examined. if this is truly a team, then of course each pirate should receive 20 pieces of gold. however, if there is a division of labor that affords certain pirates greater responsibility then we are looking at a vertically stratified solution. in this case those at the top, the CEO's of the pirates, must be given more of the booty. if there is no stratification, but the nature of the pirates is individualistic and greedy, i would assume divide the gold into pirates 2 and 4 get 25 + you get 20 + pirates 3 and 5 each get 15.

Anonymous on 18-Feb-2010
1

The first answer is right. You need to think that the pirates are rational and greedy for the most they can get. Then you need to consider what would happen with two pirates and take it from there.

Anon on 19-Feb-2010
6

He needs to shoot the ring leader(dominant) of the remaining 4 pirates and re-negotiate after reloading.

Backstrap on 19-Feb-2010
2

There isn't an optimal solution for the first pirate. The first pirate can't come up with a solution that will give 2 other pirates a maximum of the gold.
The other pirates will always vote no unless the first pirate gives one of them all 100 pieces, since it's always in their best interests to dump the guy overboard and split it amongst less people.

Chris on 21-Feb-2010
8

It's the wrong question. The question correctly stated is as follows: (credit to vorg.ca)

Five buccaneers have obtained 100 doubloons and have to divide up the loot. The buccaneers are all extremely intelligent, treacherous and selfish (especially the captain).

The captain always proposes a distribution of the loot. All buccaneers vote on the proposal, and if half the crew or more go "Aye", the loot is divided as proposed, as no buccaneer would be willing to take on the captain without superior force on their side.

If the captain fails to obtain support of at least half his crew (which includes himself), he faces a mutiny, and all buccaneers will turn against him and make him walk the plank. The buccaneers start over again with the next senior buccaneer as captain.

What is the maximum number of doubloons the captain can keep without risking his life?

interviewer with the right question on 21-Feb-2010
4

20 pieces. The captain should divide the pie equally 5 ways (20 pieces). Then explain to the four pirates that anyone who does not agree to this fair deal of equal distribution will receive nothing, and that person's share will be retained by the captain alone. No one would want the captain to get their share. Everyone would think the deal fair. And therefore the captain's life would not be at risk at all.

Jerry on 21-Feb-2010
10

Be bold, be treacherous, be past tense:
I took Pirate 2 and Pirate 3 aside. I told them, "We will split the gold evenly, three ways, between us. We three can overpower Pirate 4 and Pirate 5, so they do not receive any gold."
Then I took Pirate 4 and Pirate 5 aside. I told them, "We will split the gold evenly, three ways, between us. We three can overpower Pirate 2 and Pirate 3, so they do not receive any gold."
The vote was 100%, and I got away with all the gold, since each of the other pirates killed each other for being doublecrossed.
Since I'm telling the story, it's clear I survived.

TinaTechWriter on 24-Feb-2010
1

Splitting the gold amongst 3 of the 5 pirates (1st pirate included) gets 50% of the remain pirate vote. In this way, the pirates get the most gold and there is a majority to vote against the first pirates death.

CompSciStudent on 24-Feb-2010
0

Navy Seals kill all the pirates and return the gold to the rightful owner.

Anonymous on 25-Feb-2010
12

The leader can keep 98 of the gold coins and give 1 to the 2nd ranked and 1 to the 4th ranked pirates.

Let's assume 1st that they are so selfish that they care more about the money than each other's lives, and 2nd, that they follow this 50% rule without question.

The lowest ranking pirate, number 5, has absolutely no reason to support any other pirates, because he knows that if all the other pirates walk the plank he gets 100 pieces. Pirate number 4 knows that if he's left with pirate 5, pirate 5 will demand all the booty or vote against the proposal to kill 4 and receive it anyway. Pirate 3 recognizes pirate 4's predicament and would only have to offer him 1 piece of gold so that 4 would come out better than being stuck with making the decision and losing everything. His support would provide 3 with a majority. If it came down to pirate 3's decision, he would have 99 pieces, 4 would have 1 and 5 would have 0.

If the second ranked pirate, pirate 2, was faced with negotiating, he would need the support of 2 additional constituents. 5 will always vote against him, and 3 recognizes that he can make 99 pieces of booty if he's in control. In order to live, pirate 2 would have to offer pirate 3 99 pieces and pirate 4 1 piece, leaving him with nothing.

Pirate number 1 similarly recognizes the predicament of pirate 2. Pirate 1 only needs two other supporters. That's easy. Better that pirate 2 receives his life and even one piece of gold than nothing. Pirate one offers him 1 piece of gold. Similarly, pirate 4 knows that he can get 1 piece of gold and his life, so pirate 1 offers him 1 piece of gold and has his support.

After giving pirate 2 and pirate 4 one piece of gold each, he has their support and can take the remaining 98 pieces for himself.

QED! Yeah baby!

Marketing and Information Systems Major on 25-Feb-2010
0

The rationale set forth by Marketing and Information Systems Major is well-explained and thought out, but with one fatal error (i.e. my user name). The interviewee is correct.

Superior Force means >50% on 26-Feb-2010
5

Suppose that pirates are named by letters, with the most junior pirate in each scenario being Pirate A. I'll list the pirates in order of seniority for each case:

In a two-pirate case (Captain, Pirate A), the captain always keeps the booty. Pirate A has no leverage whatsoever, since he'll never have superior force to remove the captain.

In a three-pirate case (Captain, Pirate B, Pirate A), the captain only needs one vote. Pirate B wants to get rid of the Captain so he can be in the advantageous two-pirate case. Pirate A wants to AVOID that, so the Captain easily buys Pirate A's vote with one gold coin -- the status quo is maintained, and Pirate B gets shafted.

In a four-pirate case (Captain, Pirate C, Pirate B, Pirate A), the captain still only needs one vote (a tie means no superior force, which means the status quo is maintained and the captain wins). We pose our standard question: "If the captain loses the vote, who gets shafted?" -- well, if the captain loses, it's a three-pirate case, which means Pirate B gets shafted. So the captain easily buys Pirate B's vote with one gold coin, and the status quo is maintained. Result: Pirates A and C got shafted.

In the desired five-pirate case (captain, Pirate D, Pirate C, Pirate B, Pirate A), the captain needs TWO votes to avoid losing power. So we ask ourselves: "if the captain loses the vote, who gets shafted?" -- Pirates A and C (as determined above, in the four-pirate case).

Therefore, to maintain the status quo, the captain proposes one gold coin to Pirates A and C each, and keeps 98% of the booty for himself.

The downfall of these pirates is their inability to think laterally or deeply e.g. it's a machine question, not a human question. Subjective variables such as selflessness and morality would make these pirates much less predictable, forcing the captain to appease each and every one of them to the best of his ability, rather than knowing exactly whose vote to buy and at what price.

Gus on 27-Feb-2010
0

by "deeply" i meant creatively, and by "e.g." i meant "i.e."!! edits would be awesome.

gus on 27-Feb-2010
0

The answer is 25. If they split it 5 ways, then its 20 each. If he needs 3 votes, offer each of them 25 and nothing to the last guy, then they will approve, since 25 is more than 20 (even split).

m on 01-Mar-2010
0

Given that the first pirate needs the majority of the remaining vote (3/4) pirates. Then,
First Pirate - 25g
Crew Member 2 - 25g
Crew Member 3 - 25g
Crew Member 4 - 25g
Crew Member 5 - 0g

My logic behind this is simple. In order for their greed not to be outweighed by their survival the 4 pirates can share the booty equally with the 5th pirate as an example of the position they would find themselves in. 5th Pirate gets thrown of the ship and dies. It could stop here or they could revote,

If they revote then,
First Pirate - 33.3g
Second Pirate - 33.3g
Third Pirate - 33.3g
Fourth Pirate - 0g

Rinse and repeat until two pirates left sharing the loot 50g each.

BBristow on 02-Mar-2010
0

Wait, read the clue carefully. Let's say I'm the captain, and my pirates are 'greedy'.
Option #1: I give myself and 4 pirates 20 gold each. That's good, right? Wrong. The pirates are 'greedy', and the 4 pirates will STILL vote to throw me overboard, because that would increase their 'take' to 25 Gold each, since I no longer get any. In order for me to WIN, I need to provide them with MORE than 25 Gold each, because that's what they will get for voting me off. Therefore:
I keep 22 Gold, and I give pirates 1,2,3 each 26 GOLD. That means, if they vote me off, they will only get 25 Gold, and 26 is more than 25. Thus, the maximum I can keep is 22 Gold.
BUT, if it only takes 2 Votes (i.e, my vote counts), then I keep 34 Gold, and give pirate 2 and 3 33 Gold each. Thus, my vote + 2 pirates >50% of the votes. Pirates 3,4 get zero.

Torpedot on 02-Mar-2010
1

if they're going to kill you if you can't get 2 guys to back you up, then they can just as easily all four decide to kill you and then the remaining four are in the same quandry, but with only four shares. keep recursing until there is only one guy with all the gold.

your only chance is to give them all the gold in the hope that they will deign to let you live, then kill them while they sleep and take it back.

real world on 03-Mar-2010
0

This problem really has no solution to it - as it clearly says the one who is proposing distribution doesn't get to vote!

figure this: the lead pirate proposes a solution (98 for himself, 1/1/0/0 for others; or any other option) - but he doesn't get to vote. The others can always call this an unfair division and throw the helpless pirate out - as he doesn't have any say. Even if they decide to divide it as 20 coins each, the others can still throw the first pirate and maximise their share by 25% each - this can go on until the youngest/last pirate walks out with all the money. therefore this is an impractical situation.

However, the whole situation changes if you allow the pirate proposing the distribution to vote!!! Then the solution, as proposed by some one above, of a distribution being 98/1/1/0/0 will eventually be accepted. Search for the pirate game on Wikipedia, the question is a straight lift of that puzzle - except that someone decided to change the problem by making the lead pirate non-voting.....and that will always make this problem non-solvable.

PS: @ mktg and Systems major: Baby, you forgot to read the problem correctly and just googled it up!!!

Rajat on 04-Mar-2010
0

OK, so within the parameters as outlined, and assuming that this problem is recursive (after the first pirate doesn't get enough votes, he's killed, and they're faced with a 4-pirate situation), let's look at it thusly:

They're all greedy, and they all know that the best way is to kill everyone else and grab all of the loot. However, to do this, they _must_ be the "lowest pirate" on the pole (the last one to be given the chance of dividing the loot). If this "pecking order" is fixed (everyone knows exactly how they stand), it is different from if it is random. Let's look at both.

5-Pirates, fixed order: In this case, then the proposal outlined by Gus and the others that results in Pirate 5 getting 98 coins, and 4 and 2 getting 1 coin each works out best.

5-Pirates, random order: This is different, as the problem then becomes how the order is established after each pirate gets killed. Everybody wants to be the Last Pirate Standing (tm) (Fox, call me for show marketing rights), but as the first one gets killed, there is increasing odds that they will be chosen next, and not be the LPS. Unfortunately, in the question as posted (5 nameless, rank-less pirates) we don't know how pirate 5 got chosen to choose, and we don't know how pirate 4 will be chosen after pirate 5's demise.

In this case, Pirate 5's best play would be to give two pirates 34 gold (one more than 33, and him take 32) if only two votes are needed, or give three pirates 26 gold (one more than 25, and him take 22) if a majority vote is needed, and hope that they would see this as fitting, instead of being the next sap in the position of making a 4-way split or his life.

Dan on 04-Mar-2010
0

As stated the answer is:
25 gold pieces should go to any three pirates, with the leader keeping the remaining 25 for himself.

Note - Gus' solution is incorrect because he assumes that the leader can vote on his own proposal. The leader can't.

Also - as some others have pointed out, this probably isn't the right question. The question with a "succession plan" has a more interesting answer.

Here is the detailed reasoning:

So - I start by assuming that for all pirates, its infinitely more important to be alive than to get any gold, but if they are alive, they want as much gold as possible. The pirates, other than the leader are "unorganized", and all things being equal, they would rather have as many pirates around as possible. These are risk adverse pirates :)

Assume there was one pirate: the best proposal - take all the gold for himself, which would definitely pass.

If there were two pirates, unless the leader proposes to give all of the gold to other pirate, his companion will vote against it, and take all of the gold.

If there are three pirates: if the other two pirates have a 50% of getting nothing and a 50% chance of getting 100 gold. So the expected value for both them is 50 gold pieces. He needs two votes to stay alive, so offering either of them less than 50 will assure losing a vote, and thus his life. Therefore, the leader proposes 50 gold to each of the other pirates, and stays alive.

If there are four pirates: The remaining pirates have a 33% chance of getting nothing, and a 66% chance of getting 50 gold pieces if they reject the leader's offer. Their expected value is 33 gold pieces each. Offering any two of them 33 gold pieces, and with the leader keeping 34 is a proposal that should pass.

If there are five pirates: for the four remaining pirates, they have a 25% chance of getting 34 gold pieces, a 50% chance of getting 33, and a 25% chance of getting nothing if they reject the leader's proposal. Their expected value is: 25 gold pieces. Since three votes are needed, 25 gold pieces should go to any three pirates, with the leader keeping the remaining 25 for himself.

didIreallyjustdothis? on 04-Mar-2010
0

Are you joking? Pirates aren't fair! One pirate cheats all the others and splits with all the booty AND your women... They're pirates for chrissake!

Lisa on 05-Mar-2010
0

If I were the 1st pirate, I'd consider that goal #1 is to stay alive - my life is worth more than all the gold. So I'd propose that each of the other four pirates would receive 21 pieces of gold and I'd keep 16... and my life.

Odds are that the other pirates would find this acceptable, and they may even keep me around to make the first proposal again next time. It's a win-win. We all keep our lives and get more gold than we had before. I can't speak for other pirates, but that's what I'd do.

Schalley on 06-Mar-2010
0

The proposal has to be accepted by two of the four other pirates. The only way the first pirate can do this is interview each of the other pirates individually and ask what they think is fair. His objective is to find two that are similar enough that he can modify the two into one plan. After mofifying the two plans into one plan he then goes back and asks these two individually again if the modified plan is acceptable. If he can get these two to accept the modified plan then he presents it. It doesn't matter what the other two pirates who were left out think because he has the two votes he needs.

QAORL on 07-Mar-2010
0

There's a pot of gold no one's seeing. The end game is that the last two will share 50 gold pieces each (no majority to mutiny). So pick two friends, offer them the 100 gold pieces between them, and hope they give you some afterward (but don't bet on it). Keep the gold pot and the friends.
You lose two votes from those disenfranchised, but you and two friends hold majority might.

SpeedOfThought on 07-Mar-2010
0

Here's my thought about this.

100 gold to be distributed to 5 pirates
The first pirate proposes how it will be distributed.
He has to get 3 out of 4 votes in order to stay alive, otherwise he will be thrown out of ship and die.

Let's say pirates are in nature greedy. Second/third/fourth/fifth pirate will rather kill the first pirate to accumulate more share of gold. If the first pirate proposes anything that doesn't let him get even a gold, his proposal might be accepted and he will remain alive.

Ofcourse it might not be what will happen. The other pirates kill the first pirate and they quarrel over the pot of gold. The last-man-standing gets everything. Or they all die and no-one gets anything.

Andy on 08-Mar-2010
0

The answer is 97. Start with three pirates.

Andrew on 09-Mar-2010
0

I was once faced with this very same dillemma...I ended up splitting the gold between three of the other pirates, which got me the vote I needed. Yargh, but then me and me accomplice, the man without any gold, we shivved all the rest and threw the bodies overboard, each claiming 50 gold, yar!

kasapo the pirate on 12-Mar-2010
0

Attach the gold to a life preserver and throw it overboard . If they are so greedy they will all dive after it. You sail away with the ship and sell it for much more than 100 pieces of gold.

Ron on 16-Mar-2010
1

First, you must realize this is not just a logic question with one right answer, but a way for an employer to probe you thinking process as you talk out loud. So if you make stupid assumptions like “I’m the captain so they will let me have more” or “I will just kill them later” or “I would strike a side deal”, then you will be looked at as a dodger or lazy or scared to address the question, so that crap is out in an interview.

You might get points with this one good assumption: “It looks like the question is incomplete, I assume that the voting rounds continue until an offer is accepted or only one pirate is left.”

Facts: in round 1 the offeror needs 3 of 4 votes for a majority. In round 2 he needs 2 of 3, in round 3 he needs 2 of 2 and in round 4 he needs 1 of 1. (So now you are showing the interviewer you are thinking ahead before rushing off trying to give the answer).

So the offeror in the first round wants to maximize his gold and his chance of living. So he makes this offer. 33 Gold to each of 3 voters and 1 for himself. He explains why this is the best they can hope for as such. In the final round, the 1 voter either gets 100 pieces of declines the offer, kills the pirate and takes 100 anyway. He can even legally decline the offer of 100, kill the pirate and still take 100 pieces. Now you may think this is good, but the odds of one of the 4 of you being alive and being the voter is 1 in 4 or 25% (see mister interviewer, I can to simple math). So you have a 25% chance of 100 pieces, or 25 on average, so 33 and guaranteed life now is a better deal, in fact you should be happy if I offered you 26. But I want to take just one, so in the next round, the offeror will have to take 1 or less or face certain death, because he saw me die for just 1. In the next round, that means the 2 winning voters will want 50 pieces each. But they only have a 50% chance of being 2 of the 4 people being offered gold. That means they have a 50% chance of getting 50 pieces, on average, they get 25, again less than 33. If they want to try to make it to round 3, there will be 1 offeror and he will have to get both votes for a majority to live, so again he will have to be willing to give 50 to each. From round 1, the 4 have a 50% chance of being a voter now and a 50% chance of being dead or getting 0 and living. If they get 50 pieces, then 50% of that is 25. Still less than 33. Also, the offeror can argue that if they don’t accept his offer, then one of them will die and/or get 0 in next round, the other will get 100, but at this point on average would get only 50. So he might be willing to offer each much less then 50 to guarantee they live, so now they are worse off. In no average case are they better off than taking your 26-33 piece offer and the certainty of life. (Now, if I am the first offeror, I will probably max out their offer at 33 so I maximize my chance to live and fight another day).

Or you just pull out your light saber and kill the other 4.

PuddinHead on 16-Mar-2010
1

You need to look at the question from the end first.
As each pirate is thrown off the ship, there are fewer pirates to split the gold up with.

At the end there will be 1 pirate who gets all 100 pieces of gold.

                     Pirate 5
1 pirate 100

With two pirates, the situation looks like this:

                    Pirate 4 Pirate 5
2 pirates 0 100
1 pirate 100

Pirate 5 has no reason to accept any offer other than all the gold, since if he rejects Pirate 4’s offer, he will get all the gold, anyway.

With three pirates:

                    Pirate 3 Pirate 4 Pirate 5
3 pirates 99 1 0
2 pirates 0 100
1 pirate 100

With 1 or 2 pirates, Pirate 5 has all the power, but with three pirates, 1 piece of gold for Pirate 4 is better than any of the other conditions.

With four pirates:

                          Pirate 2 Pirate 3 Pirate 4 Pirate 5
4 pirates 97 0 2 1
3 pirates 99 1 0
2 pirates 0 100
1 pirate 100

With four pirates, Pirate 4 and 5 get a better deal than with 3 pirates.

With five pirates:
                        Pirate 1 Pirate 2 Pirate Pirate 4 Pirate 5
5 pirates 97 0 1 0 2
4 pirates 97 0 2 1
3 pirates 99 1 0
2 pirates 0 100
1 pirate 100

Pirate 3 and 5 get a better deal than with 4 pirates.

SourceOfAllTruth on 19-May-2010
0

I have just a few things to add that seem logical in order to know how to determine the answer. The most important thing to know is whether they are distributing the gold while at sea or near land (or in port). If they are at sea there is a far greater likelihood that the captain would survive regardless of the distribution, since it takes several people to man a ship.

If they are near land, the answer can only be determined by knowing the personalities of the crew and how much fear or respect the captain commands. The more fearsome the captain is, the less likelihood of a mutiny regardless of the division as long as each of the subordinates received an equitable portion and the captains share was not overly large.

The idea of 'friends' among pirates is ludicrous- pirates by nature form alliances merely for numbers, and are by defination treacherous.

The idea of trying to solve the problem mathmatically is interesting but unsubstantiated as the outcome of gold division vs staying alive would invariably be determined by the variable factors I outlined above. By solving the problem through manipulating the pirates desire to be the only one left alive, there is an underlying assumption that only one pirate is necessary to sail a large vessal at sea, which is not the case, and even pirates know that.

LOTSAFRECKLES on 07-Jan-2011
0

you find the solution by starting from the opposite end. Start with the scenario where only pirate D and E remains alive. Then D will keep everything to himself. Knowing this (if C was alive) he would offer just one gold coin to E (since he knows what happens if they choose to kill C - then E gets nothing). Continue to the point where A is still alive and you'll find: A=98, C:1, E:1

CHECK WIKIPEDIA on 03-Nov-2011
0

The question should also be that: if the top ranked pirate dies, then the whole process is repeated for the 4 remaining pirates, and so on: if the 2nd ranked pirate dies, it is repeated for the 3 remaining pirates... and so forth...

And the answer should be that if all pirates are strictly purely logically and think for himself only, then the top pirate will get 98 coins.

This question seems to suggest 2 things:

1) Since the top ranked pirate can get the most gold coins, it justifies why the top person in a company get most of the money and the fraction of the fraction is left for the people underneath.

2) Since it assumes that people underneath will not team up, maybe that's why in some companies, it is the benefit of the top for the people underneath not to be in good relationship, so that it mimics the situation above, so that the top person can get most of the gold coins.

???? on 22-Aug-2012
0

also note that if makes a difference whether if 50% of the vote is established, whether the top pirate die or whether the proposal is accepted.

matgingtinjark on 22-Aug-2012
0

> 2) Since it assumes that people underneath will not team up, maybe that's why in some companies, it is the benefit of the top for the people underneath not to be in good relationship, so that it mimics the situation above, so that the top person can get most of the gold coins.

so those companies will actually want to foster a bad relationship between people underneath. And will that company want to hire "good guys" for the company? No, because the good people are good with each other and can team up. If there are many many bad guys, then they will be all greedy and hate each other and think for themselves only and not team up. Therefore, the company may want to hire bad guys instead of good guys.

matgingtinjark on 22-Aug-2012
0

this is a trick question. if the point is to guarantee that he stay alive, he needs to make 3 pirates as happy as possible. the only way to do that is to split the entire share evenly between them. this means excluding one pirate AND HIMSELF.

Anonymous on 20-Oct-2012
0

"Anyone who's with me and votes for my proposal gets an equal share of gold. Vote against me, and you get nothing while the rest of us gets an even more equal share of the booty."

Anonymous on 17-Jan-2015
0

Assume you are the pirate who distribute the gold, you just put the gold to a heap one by one and let the rest pirate to decide when to stop picking, the first person who says 'stop' will get the whole golds in this heap and the others must distribute the other golds.

Just post the method, you can't decide how many gold you get on 09-Oct-2015

One or more comments have been removed.
Please see our Community Guidelines or Terms of Service for more information.

Add Answers or Comments

To comment on this, Sign In or Sign Up.