How can I solve this problem....?

What will be the recurrence relation for dp

@anuranjan8319918906 recurrence is this:
if((i+j)%2)
dp[i][j] = max(a[i]+dp[i+1][j],a[j]+dp[i][j-1])
else
dp[i][j] = min(dp[i+1][j],dp[i][j-1])
here dp[i][j] is maximum coins collected by player1 when coins remaining from index i to index j.
so answer is dp[0][n-1]

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.