input: 
  def solve_maze(n: int, m: int) -> List[int]:
      """
      Given the dimensions of a maze (n x m), solve the maze by finding a path from the top-left corner to the bottom-right corner.
      The maze is represented by a grid where a value of 1 indicates a walkable path and 0 indicates a wall.
      The function returns a list of integers representing the path from start to end.
      
      >>> solve_maze(3, 3)
      [1, 1, 1, 1, 1]
      >>> solve_maze(2, 2)
      [1, 1]
      >>> solve_maze(4, 4)
      [1, 1, 1, 1, 1, 1, 1, 1]
      """
      maze = Maze(n, m)
      return maze.solve_maze()
  
output:     class Maze:
          def __init__(self, n, m):
              self.n = n
              self.m = m
              self.maze = [[1 for _ in range(m)] for _ in range(n)]
              self.path = []
          
          def solve_maze(self):
              if self._solve(0, 0):
                  return self.path
              return []
          
          def _solve(self, x, y):
              if x == self.n - 1 and y == self.m - 1:
                  self.path.append(1)
                  return True
              
              if x >= 0 and x < self.n and y >= 0 and y < self.m and self.maze[x][y] == 1:
                  self.path.append(1)
                  self.maze[x][y] = 0
                  
                  if self._solve(x + 1, y):
                      return True
                  if self._solve(x, y + 1):
                      return True
                  
                  self.path.pop()
                  return False
              
              return False