Test case is wrong

4
1 2 3 4

the answer sould be 7

@s9868121001
Hello Shivam,
no answer should be 6 because both player are playing optimally i.e they both want to maximise their score.

for give testcase
t1-> piyush will pick 4 then nimit will pick 3
t2-> piyush will pick 2 then nimit will pick 1

so piyush maximum score will be 4+2 i.e 6

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.