Doubt ctfyuhuil

in this question piyush can also win with 7 and its greater than 6

no… 7 is not possible…
for input
4
1 2 3 4
in first chance piyush takes 4…
then Nimit takes 3…
then piysh takes 2
then nimit takes 1

so piyush can take max 4+2 = 6

https://ide.codingblocks.com/s/598286 u can refer to my code… this u will better understand when u study dynamic programming bcoz i have used that in this code else just by recursion we would get TLE…

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.