Easy java Begineer solution:
\n# Code\n\nclass Solution {\n    int ans=0;\n    public int maxMoves(int[][] grid) {\n        int m=grid.length;\n        int n=grid[0].length;\n            fo
\n# Code\n```\nclass Solution {\n    int ans=0;\n    public int maxMoves(int[][] grid) {\n        int m=grid.length;\n        int n=grid[0].length;\n            for(int i=0;i<m;i++){\n                boolean visited[][]=new boolean[m][n];\n                int max=0;\n                max=count(i,0,grid,visited,m,n);\n                ans=Math.max(ans,max);\n            }\n        return ans;\n    }\n    public int count(int row,int col,int grid[][],boolean visited[][],int m,int n){\n        if(visited[row][col]==true)return 0;\n        visited[row][col]=true;\n        int op1=0;\n        if(row-1>=0 && col+1<n){\n            if(grid[row-1][col+1]>grid[row][col]){\n                op1=1+count(row-1,col+1,grid,visited,m,n);\n            }\n        }\n        int op2=0;\n        if(row<m && col+1<n){\n            if(grid[row][col+1]>grid[row][col]){\n                op2=1+count(row,col+1,grid,visited,m,n);\n            }\n        }\n        int op3=0;\n        if(row+1<m && col+1<n){\n            if(grid[row+1][col+1]>grid[row][col]){\n                op3=1+count(row+1,col+1,grid,visited,m,n);\n            }\n        }\n        return Math.max(op1,Math.max(op2,op3));\n    }\n}\n```
['Depth-First Search', 'Java']