input: 
  def solve_maze(n: int, m: int) -> List[int]:
      """ Solve a maze represented by a grid of size n * m where the 1s represent 
      the path and the 0s represent the wall. The maze starts at the top-left corner 
      (0, 0) and ends at the bottom-right corner (n-1, m-1). The function should 
      return the shortest path from start to end as a list of integers representing 
      the number of steps taken. If there is no path, the function should return an 
      empty list.
      
      >>> solve_maze(3, 3)
      [4]
      >>> solve_maze(4, 4)
      [6]
      """
  
output:     
      from collections import deque
  
      def solve_maze(n: int, m: int) -> List[int]:
          maze = [[1] * m for _ in range(n)]
          directions = [(0, 1), (1, 0), (0, -1), (-1, 0)]
          queue = deque([(0, 0, 0)])
          visited = set((0, 0))
  
          while queue:
              x, y, steps = queue.popleft()
              if (x, y) == (n-1, m-1):
                  return [steps]
              for dx, dy in directions:
                  nx, ny = x + dx, y + dy
                  if 0 <= nx < n and 0 <= ny < m and (nx, ny) not in visited and maze[nx][ny] == 1:
                      visited.add((nx, ny))
                      queue.append((nx, ny, steps + 1))
          
          return []
  