Is my solution correct

I got AC , But i am not sure if i have the right logic

1.I considered the coins in each box to be individual

2.every coin at an index can be treated as a pile of coin problem of height k where k is the index at which the coin is present

3 . if the number of coins in a box is even then we ignore it

4 . if the number of coins in a box is odd then we do
answer = answer^k , where k is the index of that box(since all the coins in that box have same grundy number = k , there XOR will evaluate to k only ).
5. finally if the answer = 0 , then lose else win

please tell me if I have the right logic : )

@debyian there can be multiple ways to solve any problem, and each solution is unique. If your code has passed all the test cases it means it is taking care of the corner cases as well. Therefore the logic is correct. Any solution you present doesn’t need to be the most obvious one, it only needs to give the correct output for the given input.

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.