Test cases failing......... it shows that even test case 0 failed but i have tried the sample input and it works
@gautam74
you have taken array of hardcoded size 100.
and you need to change your logic since both the players will pick optimally does not mean they will pick the greater value between first and last.
I have tried to rewrite the code… I have taken a bool variable to track the which player is playing
i have found my mistake but still one of the test case failed and the other gave TLE … https://ide.codingblocks.com/s/459215
Look at this recursive a little bit similar to yours and read the comments for more information https://ide.codingblocks.com/s/459347
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.