My Third TESTCASE gives the wrong answer, I don’t know why. please solve my problem, why this happened.
Optimal Game Strategy-I
hi @Abhishek-Vishwakarma-653004358467067,
In this question you are not considering the case if the second element is way larger than any other . For ex: if test case is 4 9 1 2 then you will pick 4 first making 9 open to be picked hence piyush will not win .Instead if you pick 2 first then other guy has to pick either 1 or 4 hence opening up 9 for you. Try to code this case.
It still shows wrong answer.
so why we are doing for only second element? it can be extended further. how it can be done?
We do not have to do only for second element .I gave an example taking second element … you have to make a general code for any element . Use recursion or think of any other method…
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.