Find the problem in my logic

hello @vishwajeetss861999 this is not the correct approach of doing this question .
as it is clearly mentioned in the question that both the players optimally thats why it means that both the players will try to win so they will pick the maximum number they can .
but we have to make piyush win the game so for that we have to minimise the total result of the nimit .
try to implement in this way .
if you still have doubt please ask here .
Happy Learning !!

can you share the answer or modify my code

see this


if you have any doubt in understanding you can ask here .
Happy Learning !!

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.