Easy 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:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    int m,n;\n    vector<vector<int>> directions {{-1,1},{0,1},{1,1}};\n    vector<vector<int>> dp; // memozation table\n\n    int slove(vector<vector<int>>& grid,int i,int j){\n        if(i<0 && j<0 && i>=m && j>=n){\n            return 0;\n        }\n\n        if(dp[i][j] != -1){\n            return dp[i][j];\n        }\n\n        int max_score = 0;\n\n        for(vector<int> &dir :directions){\n            int new_i = i + dir[0];\n            int new_j = j + dir[1];\n\n            if(new_i >= 0 && new_i < m && new_j < n && grid[new_i][new_j] > grid[i][j]){\n                max_score = max(max_score,1+slove(grid,new_i,new_j));\n            }\n        }\n\n        return dp[i][j] = max_score;\n\n    }\n\n    int maxMoves(vector<vector<int>>& grid) {\n        m = grid.size();\n        n = grid[0].size();\n        dp = vector<vector<int>>(m,vector<int>(n,-1));\n        int result = 0;\n\n\n        for(int i = 0;i<m;i++){\n            result = max(result,slove(grid,i,0));\n        }\n\n        return result;\n        \n    }\n};\n```
['C++']