← All problemsSign in

Friend

Two Friends A and B playing a game.There is a pile of stones from which they have to pick some stones and when anyone of them will not be able to pick any stone then the opponent will win. Rules:- - A is starting the game. - They can pick 2,3 or 4 stones in a single move. - Both will play optimally. Total number of stones will be known to them i.e. N.Your task is to tell who is the winner. I

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