Unable to clr all testcases


What is wrong with my code?

@goyalvivek you are only taking coin from back side but in ques it is given that you can take from front and back both so you are missing those cases
Coding Blocks IDE
this is the implemented code we take both the cases and maximise our answer for current position
hope it clears your dout and it dout resolved rate my experience

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.

https://ide.codingblocks.com/s/590690 refer this code… also ig Prateek bhaiya has made a video on in it dynamic programming section… u can also go through it

please explain int op1 = max(a[i]+min(f(n,a,i+1,j-1),f(n,a,i+2,j)), a[j]+min(f(n,a,i+1,j-1),f(n,a,i,j-2)));

basically u have to consider two options… u can pick the first element in array and recursively check ahead… or u can pick the last element…

got it, thanks foe ur help

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.