😎Simplest CPP implementation....just DP things✅
Intuition\n Describe your first thoughts on how to solve this problem. \nWe will be starting from the bottom right element, becoz we know that for that element 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nWe will be starting from the bottom right element, becoz we know that for that element the value is 0.\n\nand than the simple traversal and from the bottom right to top left element and some calculation.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n- Create 2d dp array , and than assign 0 to the last element(dp[row-1][col-1]=0).\n- now for every element in the array we will calculate the maxRowSum and maxColSum .\n- maxRowSum : this will be the sumation which will be calculated so that to find the max value in the row in which element is present.\n- maxColSum: this will be the sumation which will be calculated so that to find the max value in the column in which element is present.\n- than we will take the max of both ans return the answer.\n\n\n# Complexity\n- Time complexity: O(n*m)*O(n+m) : where n & m are size of row and column\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(n*m) : where n & m are size of row and column\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int maxScore(vector<vector<int>>& arr) {\n        \n        int row=arr.size(), col=arr[0].size(), ans=INT_MIN;\n        \n        vector<vector<int>> dp(row, vector<int>(col, 0));\n        dp[row-1][col-1] = 0;\n        \n        \n        for(int i=row-1; i>=0; i--){\n            for(int j=col-1; j>=0; j--){\n    \n                if(i==row-1 && j==col-1)continue;\n                \n                int val = arr[i][j];\n                \n                //calculate row sum\n                int maxRowSum = INT_MIN;\n                for(int c=j+1; c<col; c++){\n                    int rowSum = (arr[i][c]-val) + dp[i][c];\n                    maxRowSum = max(maxRowSum, max(rowSum, (arr[i][c]-val)));\n                }\n                \n                //calculate column sum\n                int maxColSum = INT_MIN;\n                for(int r=i+1; r<row; r++){\n                    int colSum = (arr[r][j]-val) + dp[r][j];\n                    maxColSum = max(maxColSum, max(colSum, (arr[r][j]-val)));\n                }\n                \n               // cout<<arr[i][j]<<" "<<maxColSum<<" "<<maxRowSum<<endl;\n                \n                dp[i][j]=max(maxRowSum, maxColSum);\n                \n                ans=max(ans, max(maxRowSum, maxColSum));\n            }\n            \n        }\n        \n        return ans;\n        \n    }\n};\n```
['Array', 'Dynamic Programming', 'Python', 'C++', 'Java', 'Python3', 'C#']