How can i write top to bottom dp and bottom to top dp code of this problem

#include
using namespace std;
int dp[100][100]={-1};
int gameStrategy(int arr[],int i,int j){

if(i>j){
    return 0;
}
int ans  = max (arr[i]+min(gameStrategy(arr,i+2,j),gameStrategy(arr,i+1,j-1)),
                arr[j]+min(gameStrategy(arr,i,j-2),gameStrategy(arr,i+1,j-1)));
return ans;

}
int gameStrategyTopBottom(int arr[],int i,int j){

if(j==i+1){
    return max(arr[i],arr[j]);
}
if(dp[i][j]!=-1){
    return dp[i][j];
}
int ans  = max (arr[i]+min(gameStrategy(arr,i+2,j),gameStrategy(arr,i+1,j-1)),
                arr[j]+min(gameStrategy(arr,i,j-2),gameStrategy(arr,i+1,j-1)));
return dp[i][j]=ans;

}

int main()
{
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++)cin>>arr[i];
cout<<gameStrategyTopBottom(arr,0,n-1);
return 0;
}

Hey i would like to tell you that its not easy/feasable to write bottom-up dp solution for every problem.
Writing a code with top-down approach with memoization is absolutely good and fine.

Writing bottom up solution is feasable if you can easily think of answers for smaller problems starting from 1…2…3… and you find a pattern.