Is Coding required Everywhere..??

There are n coins in a line. Two players take turns to take a coin from one of the ends of the line until there are no more coins left. The player with the larger amount of money wins.

Would you rather go first or second? Does it matter?

Second First Doesn't matter

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

Vighnesh Raut
Apr 29, 2015

Going first puts you in a position where you can make better choices and it will guarantee a win.

Think in terms of picking odd or even numbered coins. By following this strategy, you will at the very least guarantee a tie:

If there are more odd coins than even coins, take the left-most coin in the line, and take all the odd-numbered coins. If there are more even coins than odd coins, then take the right-most, and pick all the even coins. If there are the same number, you guarantee a tie by picking only odd or only even coins.

@Vighnesh Raut Well this is a logical question... but i dint understand your logic of more odd coins than even coins and from which end you should pick up the coin .. I found it irrelevant to your question can you please guide me up and explain the reason of mentioning it?? ¨ \large{\ddot \smile}

Harshvardhan Mehta - 6 years, 1 month ago

Log in to reply

Thanks.. I have updated the question by removing the tag All coins are of same type

Vighnesh Raut - 6 years, 1 month ago

But I think going first depends on if there are odd number of coins. Say 5 , then going first means I have 3 coins. And suppose there are even number of coins say 4 then I and other person will have same amount of coins. { this only depends if we are taking turns in picking coins ]

Pranav Raj - 6 years ago
Curtis Clement
Jul 31, 2015

You should go first to obtain 2 of the following possibilities: 1) If there are 2k coins then you both will have k coins at the end = draw 2)If there are 2k+1 coins then you will have k+1 coins whilst your opponent will have k coins = win.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...