Dart simple answer and explanation
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```dart []\nclass Solution {\n  int maxMoves(List<List<int>> grid) {\n    int rows = grid.length;\n    int cols = grid[0].length;\n    List<List<int>> dp = List.generate(rows, (_) => List.filled(cols, -1));\n\n    // Helper function to check if the coordinates are within bounds\n    bool isValid(int row, int col) => row >= 0 && row < rows && col >= 0 && col < cols;\n\n    // DFS function with memoization to calculate maximum moves from a cell\n    int dfs(int row, int col) {\n      if (dp[row][col] != -1) return dp[row][col]; // Return cached result\n      \n      int maxMoves = 0;\n      List<List<int>> directions = [\n        [-1, 1], // Diagonally up-right\n        [0, 1],  // Right\n        [1, 1]   // Diagonally down-right\n      ];\n\n      for (var dir in directions) {\n        int newRow = row + dir[0];\n        int newCol = col + dir[1];\n\n        // Move to the next cell only if it has a strictly greater value\n        if (isValid(newRow, newCol) && grid[newRow][newCol] > grid[row][col]) {\n          maxMoves = maxMoves > dfs(newRow, newCol) + 1 ? maxMoves : dfs(newRow, newCol) + 1;\n        }\n      }\n\n      dp[row][col] = maxMoves;\n      return dp[row][col];\n    }\n\n    // Start DFS from each cell in the first column\n    int result = 0;\n    for (int row = 0; row < rows; row++) {\n      result = result > dfs(row, 0) ? result : dfs(row, 0);\n    }\n\n    return result;\n  }\n}\n\n<!-- Goal: Find the maximum moves from any cell in the first column, moving right to cells with greater values in specific directions (up-right, right, down-right).\n\nDP Table (dp): dp[row][col] stores the maximum moves from each cell, calculated once and reused to save time.\n\nDFS with Memoization: The dfs function explores each valid move, caching results in dp to avoid repeated calculations.\n\nMain Execution: Starts DFS from every cell in the first column and tracks the maximum moves found. -->\n\n\n```
['Dart']