• C++ Programming for Financial Engineering
    Highly recommended by thousands of MFE students. Covers essential C++ topics with applications to financial engineering. Learn more Join!
    Python for Finance with Intro to Data Science
    Gain practical understanding of Python to read, understand, and write professional Python code for your first day on the job. Learn more Join!
    An Intuition-Based Options Primer for FE
    Ideal for entry level positions interviews and graduate studies, specializing in options trading arbitrage and options valuation models. Learn more Join!

A Fun Interview Question

I think the generalization should be

Case 1: For 4 < N <= 200
---------------------------------------
P(N) gets {100 - (N/2)} coins. {N/2 == only the integral part of the quotient}

P(N-1) gets nothing
Among P(1) to P(N-2), any {N/2} of them get 1 coin each. { The explanation for this is given in my previous post}
----------------------------------------
Case 2: For 200 < N
All P(N), for (N > 200 ) will be killed
And Case (1) will come into effect.

In general, C is the maximum number of coins, then no pirates older than (2C+1) will survive.
For example, C = 100 as given in this problem. When N = 201, he can give 1 coin each to the 100 juniors, he gets nothing, so those 100 will vote for the proposal + himself(he has to vote for himself to survive) makes it 101 > 50%.

Note1: In the quote above, 200 should have been replaced by 201.
Note2: I have been assuming total number of coins = 100 so far.
 
In general, C is the maximum number of coins, then no pirates older than (2C+1) will survive.
For example, C = 100 as given in this problem. When N = 201, he can give 1 coin each to the 100 juniors, he gets nothing, so those 100 will vote for the proposal + himself(he has to vote for himself to survive) makes it 101 > 50%.

Note1: In the quote above, 200 should have been replaced by 201.
Note2: I have been assuming total number of coins = 100 so far.

In that case, the 202th pirate will also survive. The question says that at least 50% of the vote is needed. So if N=202, the will get the approval from pirate 2, 4, 6, ... , 200, plus himself. Which is 50%
 
"In general, C is the maximum number of coins, then no pirates older than (2C+1) will survive."

Can you explain why (and why those pirates won't simply instead vote in favor of any proposal?)
 
In that case, the 202th pirate will also survive. The question says that at least 50% of the vote is needed. So if N=202, the will get the approval from pirate 2, 4, 6, ... , 200, plus himself. Which is 50%
I agree that 202 survives, I missed this point. In fact it doesn't stop at 202..pls see below


"In general, C is the maximum number of coins, then no pirates older than (2C+1) will survive."

Can you explain why (and why those pirates won't simply instead vote in favor of any proposal?)

You are 50% right, if you follow my assumption. If you follow the other assumption (which goodstudent & marilapi is following), all the odd ones for N > 202 will get killed. All the even ones survives for N > 202. Please refer to case (6) below, all the way at the bottom. Pls lemme know if I missed any more points. This is getting more and more complex now..I might have missed some cases.


Updated cases:
-----------------------------------------------------------------
Case (1): For 4 < N < 200
---------------------------------------
P(N) gets {100 - (N/2)} coins. {N/2 == only the integral part}
P(N-1) gets nothing
Among P(1) to P(N-2), any {N/2} of them get 1 coin each.
----------------------------------------
Case (2): N >= 200
P(N) gets 0 coins if N is odd, 1 coin if N is even.
Among P(k), { (0 < k < 200)&&( k != (N-1)) OR ((N - 1) > k > 199)&&(k is even number)
99 (If N is even) or 100 (If N is odd) of them will get one coin each.
----------------------------------------
This covers all cases, but I have explained few cases below.


Examples:
---------------------------------------
Case (3): N = 201
P(200) & P(201) gets nothing.
Among P(1) to P(199), any 100 of them get 1 coin each.
---------------------------------------
Case (4) N = 202
P(202) gets one coin
Among P(1) to P(200), any 99 of them get 1 coin each.
P(201) will vote (As per my assumption, he won't get any coins anyway)
Hence P(202) will get 99 + P(202) + P(201) = 101 votes
-------------------------------
Case 5: N = 203
P(N> 200) gets no coins
Among P(1) to P(200), any 100 of them get 1 coin each.
Here P(203) will survive according to my assumption (since P(201) will vote for him in spite of not getting any coins), else he will be killed.
If he is killed Case (4) will come into effect.
-------------------------------
Case 6: N = 203, According to the assumption which goodstudent & marilapi is following:
P(203) MAY get killed.
Since he can only get 101 votes. P(201) need not vote for him without a coin, and he can get votes of 100 odd numbered pirates out of 101 odd numbered pirates other than himself.

Similarly all odd ones may get killed, even ones survives for N >=203.
 
Lots of interesting answers, guys. I don't have the solution to the pirates problem, but think you have it pretty much covered. My answer would have been

P(5) = 498, P(2) = 1, and P(1) = 1.

I am not sure whether it really matters if P(3) or P(2) get the other coin. Either of them should be happy about receiving any number of coins, since they know that they'll definitely loose out if they vote against P(5) and get him killed. P(2), in particular, will always loose out - unless the count is down to 2.

I guess it would also depend on which characteristic outweighs? Intelligence or greed? If the count was down to 2 pirates, P(2) would walk away with 500 coins. The question is though, with him knowing as to how unlikely this is going to be (being intelligent), whether he would take that chance?
 
Back
Top