Doubt in test case

In the given test case,
4
1 2 3 4

Piyush will first pick 4, then the remaining is 1 2 3
now if nimit will pick 1 then remaining is 2 3.
So now piyush can pick 3 and the total would be 7(4+3).
But in test case he is choosing 2 and hence the total is 6 which is smaller than 7!

Hello @rohitmathur.mathur.6 it is written in the question that both the players will play optimally so then nimit will also choose the maximum number which can make him win.
So he will choose 3 then. Then piyush will choose 2 so in this the result of piyush is 6.

Yeah i figured that out, but in the explanation it was written that nimit will either choose 1 or 3.
That’s why i got confused!

@rohitmathur.mathur.6 is this clear now? or do you want me to discuss with any other example as well?

No it is clear now.
Thank you!

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.