input: from typing import List, Tuple
  
  def solve_maze(grid: List[List[int]], start: Tuple[int, int], end: Tuple[int, int]) -> List[int]:
      """
      Solve a maze represented as a 2D grid where 1 represents a path and 0 represents a wall.
      The function should return a list of integers representing the length of the path from the start to the end.
  
      >>> solve_maze([[1, 0, 1], [1, 1, 1], [0, 1, 1]], (0, 0), (2, 2))
      [4]
      >>> solve_maze([[1, 0, 0], [1, 1, 0], [0, 1, 1]], (0, 0), (2, 2))
      [3]
      """
output:     from collections import deque
  
      rows, cols = len(grid), len(grid[0])
      directions = [(0, 1), (1, 0), (0, -1), (-1, 0)]
      queue = deque([(start[0], start[1], 0)])
      visited = set()
      visited.add(start)
  
      while queue:
          x, y, dist = queue.popleft()
  
          if (x, y) == end:
              return [dist]
  
          for dx, dy in directions:
              nx, ny = x + dx, y + dy
              if 0 <= nx < rows and 0 <= ny < cols and grid[nx][ny] == 1 and (nx, ny) not in visited:
                  visited.add((nx, ny))
                  queue.append((nx, ny, dist + 1))
  
      return []