Only 1 Test case is passing

Please find the error in my Code.

Hello @manthan.joshi.jiit
read this:
we dont have to minimise the value for nimit for that particular value but we have to minimise the overall result.
like in the sample test case when piyush picks up the max element i.e 4 then you nimit will pick up 3 as he is also playing optimally .
by optimally we mean that every turn of nimit will try to maximise his result.
let us take the example of the test case .
10
22 50 16 13 8 41 25 43 8 7
in this the piyush chooses number are 7+50+13+41+43
and nimit chooses number are 22+16+8+25+8.
and the output for piyush will be 154.
and dry run your code for this test case as well.
if you have any doubt you can ask here;

@manthan.joshi.jiit i dont find your logic is right.
please go through the above logic and tell me if you hvae any doubt.
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.