I cannot makeout the dp solution for this , i am able to do it with memoization
my code link:https://ide.codingblocks.com/s/84182
Optimal Strategy -I dp solution
There is a error in line no 39 and 40 and 42 of your code as
int q1=ar[i]+min(optimal_strategy(ar,i+2,j),optimal_strategy(ar,i+1,j-1));
int q2=ar[j]+min(optimal_strategy(ar,i,j-2),optimal_strategy(ar,i+1,j-1));
int q=max(q1,q2);
dp[i][j]=q;
kindly recheck it my memoization solution is correct , I wanted a bottom approach fro this problem,kindly check my doubt description
what is the error? I am getting time limit error even after memoization
Refer to this dp solution for your understanding.