✅ Java Solution
CODE\nJava []\npublic int maxScore(List<List<Integer>> grid) {\n\tint r = grid.size(), c = grid.get(0).size();\n\tint res = Integer.MIN_VALUE;\n\n\tint[][] arr 
## **CODE**\n```Java []\npublic int maxScore(List<List<Integer>> grid) {\n\tint r = grid.size(), c = grid.get(0).size();\n\tint res = Integer.MIN_VALUE;\n\n\tint[][] arr = new int[r][c];\n\tfor(int i=r-1; i>=0; i--) {\n\t\tint max = grid.get(i).get(c-1);\n\t\tarr[i][c-1] = max;\n\t\tfor(int j=c-2; j>=0; j--) {\n\t\t\tint val = grid.get(i).get(j);\n\n\t\t\tint diff = max-val;\n\t\t\tres = Math.max(res, diff);\n\t\t\tmax = Math.max(max, val);\n\n\t\t\tarr[i][j] = diff;\n\t\t}\n\t}\n\n\tfor(int j=c-1; j>=0; j--) {\n\t\tint val = grid.get(r-1).get(j);\n\t\tint max = val;\n\t\tif(j < c-1 && arr[r-1][j]>0) max = val+arr[r-1][j];\n\n\t\tfor(int i=r-2; i>=0; i--){\n\t\t\tval = grid.get(i).get(j);\n\n\t\t\tint diff = max-val;\n\t\t\tres = Math.max(res, diff);\n\n\t\t\tif(j < c-1 && arr[i][j]>0) val+=arr[i][j];\n\t\t\tmax = Math.max(max, val);\n\t\t}\n\t}\n\n\treturn res;\n}\n```
['Java']