have alook into my code and suggest changes not give me another code
and explain also how its diff if we get to 0 at last.
Piles again n piles go to 1 till j<i
See, it seems you are trying to apply Grundy number. Keep in mind we need take xor of for every odd number, whereas you have made ans =1 in case of a[1] is odd.
Also we need to take xor with i not with a[i], and i needs to be from 0-n-1
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.