I coulnt understand the given example

In this if firstly piyush picks 4 , then nimish can pick 1 or 3, to get maximum lets assume nimish picks 1 , then piyush can pick 2 or 3 , therefore if piyush picks 3 he can a get maximum of 7 .

@lakshit
After Piyush picks 4 , the remaining array is [1,2,3] and its Nimit’s turn. It’s true we have to maximise Piyush’s score but what you are forgetting is that Nimit knows how to play optimally as well. It is clearly mentioned that both players play optimally. Hence Nimit would simply never pick 1 if he has a choice to pick 3 as well. He will pick 3 and then ultimately, Piyush will get a score of 6 only.