Simple C++ solution
Intuition\n Describe your first thoughts on how to solve this problem. \nTry to find the highest range in every possible sub-matrix / sub-problem.\n# Approach\n
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nTry to find the highest range in every possible sub-matrix / sub-problem.\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    int maxScore(vector<vector<int>>& grid) {\n        int res = INT_MIN;\n\n        for(int i=0;i<grid.size(); i++){\n            for(int j=0;j<grid[0].size(); j++){\n                int localRange = INT_MIN;\n                if( i-1>=0 && j-1>=0 ){\n                    localRange = grid[i][j] - min(grid[i-1][j], grid[i][j-1]);\n                    grid[i][j] = min( grid[i][j], min(grid[i-1][j], grid[i][j-1]) );\n                }else if(i-1>=0){\n                    localRange = grid[i][j] - grid[i-1][j] ;\n                    grid[i][j] = min( grid[i][j], grid[i-1][j] );\n                } else if(j-1>=0){\n                    localRange = grid[i][j] - grid[i][j-1] ;\n                    grid[i][j] = min( grid[i][j], grid[i][j-1] );\n                }\n                res = max(res, localRange);\n            }\n        }\n        return res;\n    }\n};\n```
['C++']