I am not able to understand its explaination

i am not able to understand this question

hello @dhanu9721 in this question as it is mentioned that both the players play optimally that means that both the players want to win so they will try to maximise their result in the greedy way that the player whose turn is this will try pick the one with the greater value .
but we cannot do this question in the greedy way as we have to check for future rather than only picking greedily .
and in this way we have to minimise the nimits choice and we have to maximise the piyush outcomes.
here for your reference i am attaching the code :


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.