input: 
  def solve_maze(maze: Maze) -> List[int]:
      """ Given a Maze object that represents the maze structure, solve the maze and
      return a list of steps needed to reach from the start (top-left corner) to the end
      (bottom-right corner).
      >>> maze1 = Maze(2, 2)
      >>> maze1._grid = [[1, 1], [1, 1]]
      >>> solve_maze(maze1)
      [2]
      >>> maze2 = Maze(3, 3)
      >>> maze2._grid = [[1, 0, 1], [1, 1, 1], [0, 0, 1]]
      >>> solve_maze(maze2)
      [4]
      """
  
output:     def dfs(x, y, path):
          if x == maze.rows - 1 and y == maze.cols - 1:
              return path
          for dx, dy in [(-1, 0), (1, 0), (0, -1), (0, 1)]:
              nx, ny = x + dx, y + dy
              if 0 <= nx < maze.rows and 0 <= ny < maze.cols and maze._grid[nx][ny] == 1:
                  maze._grid[nx][ny] = 0
                  result = dfs(nx, ny, path + [maze.get_direction(dx, dy)])
                  if result:
                      return result
          return None
  
      maze._grid[0][0] = 0
      return dfs(0, 0, [])