DP SOLUTION(tabulation)
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int maxScore(List<List<Integer>> grid) {\n        int[][] ques=new int[grid.size()][grid.get(0).size()];\n        for(int i=0;i<grid.size();i++)\n        {\n            for(int j=0;j<grid.get(0).size();j++)\n            {\n                ques[i][j]=grid.get(i).get(j);\n            }\n        }\n        int[][] dp=new int[ques.length][ques[0].length];\n\n       \n        for(int i=ques.length-1;i>=0;i--)\n        {\n            for(int j=ques[0].length-1;j>=0;j--)\n            {\n                if(i==ques.length-1 && j==ques[0].length-1)\n                {\n                    dp[ques.length-1][ques[0].length-1]=0;\n                }\n\n                \n                else\n                {\n                   int max=Integer.MIN_VALUE;\n                   for(int k=i,l=j+1;l<ques[0].length;l++)\n                   {\n                       max=Math.max(max,(ques[k][l]-ques[i][j]));\n                       max=Math.max(max,dp[k][l]+(ques[k][l]-ques[i][j]));\n                   }\n\n                   for(int l=j,k=i+1;k<ques.length;k++)\n                   {\n                      max=Math.max(max,(ques[k][l]-ques[i][j]));\n                       max=Math.max(max,dp[k][l]+(ques[k][l]-ques[i][j]));\n                   }  \n                    dp[i][j]=max;\n                }   \n            }  \n        }\n\n        int ans=Integer.MIN_VALUE;\n        for(int i=0;i<dp.length;i++)\n        {\n            for(int j=0;j<dp[0].length;j++)\n            {     if(i==ques.length-1 && j==ques[0].length-1)\n                {\n                    break;\n                }\n                 ans=Math.max(ans,dp[i][j]);\n            }\n        }\n\n        return ans;\n    }\n}\n```
['Java']