DP || JAVA || Memoization
Complexity\n- Time complexity: O(mn)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(mn)\n Add your space complexity here, e.g. O(n) \n\n# 
# Complexity\n- Time complexity: $$O(m*n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(m*n)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    int[][] dp;\n    int m,n;\n    int min=-(int)1e7;\n    int max=min;\n    private int helper(int i,int j,List<List<Integer>> g){\n        if(i>=m || j>=n)return min;\n        if(dp[i][j]!=min)return dp[i][j];\n\n        int v = g.get(i).get(j);\n\n        int ml1=min;\n        int ml2=min;\n        if(i!=m-1)ml1 =g.get(i+1).get(j)-v+ Math.max(0,helper(i+1,j,g));\n        if(j!=n-1)ml2 =g.get(i).get(j+1)-v+ Math.max(0,helper(i,j+1,g));\n        int ml = Math.max(ml1,ml2);\n        dp[i][j] = ml;\n        max = Math.max(max,dp[i][j]);\n        return dp[i][j];\n    }\n    \n    public int maxScore(List<List<Integer>> g) {\n        m = g.size();\n        n = g.get(0).size();\n        dp = new int[m][n];\n        for(int i=0;i<m;i++){\n            Arrays.fill(dp[i],min);\n        }\n        helper(0,0,g);\n        return max;\n    }\n}\n```
['Dynamic Programming', 'Memoization', 'Java']