Recursion + memoization || standard approach
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```cpp []\nclass Solution {\npublic:\n\n    int f(int i , int j , vector<vector<int>> &grid , int n , int m  , vector<vector<int>> &dp ){\n        if(i>=n || j >=m || i < 0 || j < 0 ) return 0;\n        if(dp[i][j] != -1) return dp[i][j];\n        int right = -1e8;\n        int down = -1e8;\n        int op3 = -1e8;\n        int op4 = -1e8;\n        if(i+1 < n) right = grid[i+1][j] - grid[i][j] + f(i+1 , j , grid , n ,  m , dp);\n        if(j+1 < m) down =  grid[i][j+1] - grid[i][j] + f(i , j+1 , grid , n ,  m , dp); \n        if(i+1 < n ) op3 = grid[i+1][j] - grid[i][j];\n        if(j+1 < m) op4 = grid[i][j+1] - grid[i][j];\n        \n        return dp[i][j] =  max(right , max(down , max(op3 , op4)));\n    }\n\n    int maxScore(vector<vector<int>>& grid) {\n        int n = grid.size();\n        int m = grid[0].size();\n        vector<vector<int>> dp(n, vector<int>(m , -1));\n        int maxi = -1e8;\n        for(int i = 0 ; i < n ; i++){\n            for(int j = 0 ; j < m ; j++){\n                maxi = max(maxi , f(i ,  j , grid , n ,  m , dp ));\n            }\n        }\n        return maxi;\n    }\n};\n```
['C++']