Simple Java bottom up dp
Approach\n Describe your approach to solving the problem. \nfor each of the cell, it will only be possible coming from 3 nearby cell in prev column.\nThe steps 
# Approach\n<!-- Describe your approach to solving the problem. -->\nfor each of the cell, it will only be possible coming from 3 nearby cell in prev column.\nThe steps of this cell is the max of prev 3 cell\'s steps + 1;\nPlease note, if none of the prev cell can be reachable, this cell is not reachable either.\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(M * N);\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nO(M * N);\n# Code\n```\nclass Solution {\n    public int maxMoves(int[][] grid) {\n        int m = grid.length, n = grid[0].length, res = 0;\n        int[][] dp = new int[m][n];\n        for (int i = 0; i < m; i++) dp[i][0] = 1;\n        for (int j = 1; j < n; j++) {\n            for (int i = 0; i < m; i++) {\n                if (i - 1 >= 0 && grid[i - 1][j - 1] < grid[i][j])\n                    dp[i][j] = Math.max(dp[i][j], dp[i - 1][j - 1]);\n                if (grid[i][j - 1] < grid[i][j])\n                    dp[i][j] = Math.max(dp[i][j],  dp[i][j - 1]);\n                if (i + 1 < m && grid[i + 1][j - 1] < grid[i][j])\n                    dp[i][j] = Math.max(dp[i][j],  dp[i + 1][j - 1]);\n                if (dp[i][j] > 0) dp[i][j]++;\n                res = Math.max(res, dp[i][j] - 1);\n            }\n        }\n        return res;\n    }\n}\n```
['Java']