The Unbeatable Strategy for a Coin Game!
Why strategy needed in the case?
Let's recall the example given in the question.
-------------------------------------------------------------------
Example
18 20 15 30 10 14
First Player picks 18, now row of coins is
20 15 30 10 14
Second player picks 20, now row of coins is
15 30 10 14
First Player picks 15, now row of coins is
30 10 14
Second player picks 30, now row of coins is
10 14
First Player picks 14, now row of coins is
10
Second player picks 10, game over.
The total value collected by second player is more (20 +
30 + 10) compared to first player (18 + 15 + 14).
So the second player wins.
---------------------------------------------------------------------------------
Here, it's very clear that the player who chooses coins numbered at even positions wins & the one who chooses odd position loses.
So first player who is going to choose coin first need to be smart. All that he/she need to do is make sum of values of all coin at even position, sum of values of all coins at odd positions and compare them.
If he finds the sum of values of coins at odd position greater then he should choose 1st coin (odd position) followed by 3rd,5th.....(odd positions) & force other to choose even coins
And if he finds the sum of values of coins at even positions greater then he should choose
last coin (which is at even position as number of coins are even).
For example, in above case,
18 20 15 30 10 14
first player calculates
Sum of odd coins = 18 + 15 + 10 = 43
Sum of even coins = 20 + 30 + 14 = 64.
Since sum of even coins is greater, he should choose 6th coin (which will be followed by 4th and 2nd) and force other player to choose 5th,3rd and 1st coin.
Even in case second player selects 1st coin after 14 at other corner is selected by first, still he can be forced to choose the coin at 3rd position (odd position) if first player selects 2nd coin.
In short, first player need to make sure that he collects all the coins that are at even positions or odd position whichever has greater sum!
Note that the total number of coins in the case can't be odd as then distribution of coins among 2 will be unequal.
Comments
Post a Comment