Can anybody help whats wrong in the code as output is wrong
Hello @pranjuldwivedi120568 could you please explain your approach as I don’t think you code is optimised for both the players.
i only have make this code for the first player which is taken into consideration and as we have to add the max value for the player1 alternative time so i have maintained a variable count for that
@pranjuldwivedi120568 No you dont have to check only for the first player but you have to check optimally as it is mentioned that both the players will choose the answer to give the maximum result.
understand with this:
take this example:
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.
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.