← All problemsSign in

Two players and coins

Two players ‘A’ and ‘B’ are playing a game. They were given N number of coins where ‘N’ is even and they will get alternative turns in which player can select a coin from one of the end. The winner is the player with maximum amount of sum. At what position first or second does player ‘A’ need to start the game in order to win the game and how much ‘A’ can collect starting at that position. Inpu

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start