🔥💯| Full Java Solution | Explanation | ✅🎯
Intuition\nThe problem seems to be about finding the maximum score that can be obtained from a grid of integers. The intuition is to use dynamic programming to 
# Intuition\nThe problem seems to be about finding the maximum score that can be obtained from a grid of integers. The intuition is to use dynamic programming to keep track of the maximum future value that can be obtained from each cell in the grid.\n\n# Approach\n1. Initialize a 2D array `maxFutureValue` of the same size as the grid with all values set to `Integer.MIN_VALUE`.\n2. Set the value of the bottom-right cell of `maxFutureValue` to the maximum of 0 and the value of the corresponding cell in the grid.\n3. Iterate over the grid in reverse row-major order. For each cell:\n   - If it\'s not the last row, update its value in `maxFutureValue` to the maximum of its current value and the value of the cell below it in `maxFutureValue`.\n   - If it\'s not the last column, update its value in `maxFutureValue` to the maximum of its current value and the value of the cell to its right in `maxFutureValue`.\n   - Update its value in `maxFutureValue` to the maximum of its current value and the value of the corresponding cell in the grid.\n4. Initialize `maxScore` to `Integer.MIN_VALUE`.\n5. Iterate over the grid in row-major order. For each cell:\n   - If it\'s not the last row, update `maxScore` to the maximum of its current value and the difference between the value of the cell below it in `maxFutureValue` and the value of the corresponding cell in the grid.\n   - If it\'s not the last column, update `maxScore` to the maximum of its current value and the difference between the value of the cell to its right in `maxFutureValue` and the value of the corresponding cell in the grid.\n6. Return `maxScore`.\n\n# Complexity\n- Time complexity: The time complexity is $$O(mn)$$, where `m` and `n` are the number of rows and columns in the grid, respectively. This is because you\'re iterating over each cell in the grid twice.\n- Space complexity: The space complexity is also $$O(mn)$$, as you\'re using a 2D array of the same size as the grid to store the maximum future values.\n\n# Code\n``` Java []\nclass Solution {\n    public int maxScore(List<List<Integer>> grid) {\n        int m = grid.size();\n        int n = grid.get(0).size();\n        int[][] maxFutureValue = new int[m][n];\n        for (int[] row : maxFutureValue) {\n            Arrays.fill(row, Integer.MIN_VALUE);\n        }\n        maxFutureValue[m - 1][n - 1] = Math.max(0, grid.get(m - 1).get(n - 1));\n        for (int i = m - 1; i >= 0; i--) {\n            for (int j = n - 1; j >= 0; j--) {\n                if (i < m - 1) {\n                    maxFutureValue[i][j] = Math.max(maxFutureValue[i][j], maxFutureValue[i + 1][j]);\n                }\n                if (j < n - 1) {\n                    maxFutureValue[i][j] = Math.max(maxFutureValue[i][j], maxFutureValue[i][j + 1]);\n                }\n                maxFutureValue[i][j] = Math.max(maxFutureValue[i][j], grid.get(i).get(j));\n            }\n        }\n        int maxScore = Integer.MIN_VALUE;\n        for (int i = 0; i < m; i++) {\n            for (int j = 0; j < n; j++) {\n                if (i < m - 1) {\n                    maxScore = Math.max(maxScore, maxFutureValue[i + 1][j] - grid.get(i).get(j));\n                }\n                if (j < n - 1) {\n                    maxScore = Math.max(maxScore, maxFutureValue[i][j + 1] - grid.get(i).get(j));\n                }\n            }\n        }\n        return maxScore;\n    }\n}\n\n```
['Java']