Game Theory 1 : Challenges

Sir since all the piles have same number of coins therefore Grudey number will be same for all the piles. If there are even number of piles then xor will be 0 and 2 will win, otherwise 1 will win.
So, basically I am trying to check if n is odd or even.

Is there anything wring in this approach ?

anything wrong* in this

@aman_ishan
Your approach is fine. Just take care of one more condition.

For N pile
For m stones each:
Find divisors of m
Let say a1,a2,a3…an
Grundy(m)=Max(Grundy(a1),Grundy(a2),Grundy(a3),…)
Ans=2 if((Grundy(m)==0)||(n%2==0))
else
Ans=1
You shall do all these things in optimized way.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.