Easy DP Solution :)
Code\n\nclass Solution {\npublic:\nvector<vector<vector<int>>>dp;\n    int f(vector<vector<int>>&grid,int i,int j,int s){\n        if(i>=grid.size()||j>=grid[0]
# Code\n```\nclass Solution {\npublic:\nvector<vector<vector<int>>>dp;\n    int f(vector<vector<int>>&grid,int i,int j,int s){\n        if(i>=grid.size()||j>=grid[0].size()){\n            if(s==2)return 0;\n            return -1e6;\n        }\n        if(dp[i][j][s]!=-1e9)return dp[i][j][s];\n        int val = 0;\n        if(s){\n            val = max({grid[i][j],f(grid,i+1,j,2),f(grid,i,j+1,2)});\n            return dp[i][j][s]=val;\n        }\n        val = max({f(grid,i+1,j,s),f(grid,i,j+1,s),f(grid,i+1,j,1)-grid[i][j],f(grid,i,j+1,1)-grid[i][j]});\n        return dp[i][j][s]=val;\n    }\n    int maxScore(vector<vector<int>>& grid) {\n        dp.assign(grid.size(),vector<vector<int>>(grid[0].size(),vector<int>(3,-1e9)));\n       return f(grid,0,0,0); \n    }\n};\n```
['C++']