← All problemsSign in

The Root Sub Game

GANDEY and GHATAK play the following game. They choose a number N to play with. The rules are as follows : 1) GANDEY plays first, and the two players alternate. 2) In his turn, if N is a perfect square the player reduces N to square root of N and if N is not a perfect square he subtracts 1 from N . The number thus obtained is the new N. 3) The game ends when N reaches 1. 4) The person who fin

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