Easy Java dp based solution
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:O(N2)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(N2)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```java []\nclass Solution {\n    int[][] dp;  // Memoization table\n    int[] dx = {-1, 0, 1};  // Vertical moves\n    int[] dy = {1, 1, 1};   // Horizontal moves to the next column\n    int rows, cols;\n\n    public int maxMoves(int[][] grid) {\n        rows = grid.length;\n        cols = grid[0].length;\n        dp = new int[rows][cols];\n\n        // Initialize dp with -1 to mark uncomputed states\n        for (int[] row : dp) {\n            Arrays.fill(row, -1);\n        }\n\n        int maxMoves = 0;\n        for (int i = 0; i < rows; i++) {\n            maxMoves = Math.max(maxMoves, dfs(grid, i, 0));\n        }\n\n        return maxMoves;\n    }\n\n    public int dfs(int[][] grid, int row, int col) {\n        if (col == cols - 1) {\n            return 0;  // Last column, no further moves\n        }\n\n        if (dp[row][col] != -1) {\n            return dp[row][col];\n        }\n\n        int maxMoves = 0;\n        for (int i = 0; i < 3; i++) {\n            int newRow = row + dx[i];\n            int newCol = col + dy[i];\n\n            if (newRow >= 0 && newRow < rows && newCol < cols && grid[newRow][newCol] > grid[row][col]) {\n                maxMoves = Math.max(maxMoves, 1 + dfs(grid, newRow, newCol));\n            }\n        }\n\n        dp[row][col] = maxMoves;  // Memoize the result\n        return dp[row][col];\n    }\n}\n\n```
['Dynamic Programming', 'Matrix', 'Java']