Explained the approach || DP solution
Intuition\nmax(c2-c1)=>c2 should be maximum and c1 should be minimum\n# Approach\nApproach written in  the code in form of comments:)\n# Complexity\n- Time comp
# Intuition\nmax(c2-c1)=>c2 should be maximum and c1 should be minimum\n# Approach\nApproach written in  the code in form of comments:)\n# Complexity\n- Time complexity:\nO(n*m)\n- Space complexity:\nO(n*m)\n# Code\n```\nclass Solution {\npublic:\n    int maxScore(vector<vector<int>>& grid) {\n      int n=grid.size(),m=grid[0].size();\n      int max_ans=-1e9;\n      vector<vector<int>>dp(n,vector<int>(m,1e9));\n      dp[0][0]=grid[0][0];\n      //initialise the min value for zeroth row and col\n      for(int i=1;i<m;i++){\n        dp[0][i]=min(dp[0][i-1],grid[0][i]);\n      }\n      for(int j=1;j<n;j++){\n        dp[j][0]=min(dp[j-1][0],grid[j][0]);\n      }\n      //(c2-c1) to be maximum c2 should be maximum and c1 should be minimum\n      //get the minimum of points for each grid\n      for(int i=1;i<n;i++){\n        for(int j=1;j<m;j++){\n            //since we can move right and bottom\n            dp[i][j]=min(dp[i-1][j],dp[i][j-1]);\n            //if grid[i][j] itself is the min\n            dp[i][j]=min(dp[i][j],grid[i][j]);\n        }\n      }\n    // to get the maximum score we can subtract each value of grid to min(just above,just left)\n    //and take the maximum of all the values\n      for(int i=0;i<n;i++){\n        for(int j=0;j<m;j++){\n            if(j>0)\n            max_ans=max(max_ans,grid[i][j]-dp[i][j-1]);\n            if(i>0)\n            max_ans=max(max_ans,grid[i][j]-dp[i-1][j]);\n        }\n      }\n      return max_ans;\n    }\n};\n```
['Dynamic Programming', 'Matrix', 'C++']