input: Write a function called `create_maze_solver` that creates a new instance of the `Maze` class with given dimensions `n` and `m`. The function should return the `Maze` object. Additionally, implement the `solve_maze` method of the `Maze` class to solve the maze if a path exists from the start to the end, returning the length of the path. If no path exists, return an empty list.
  
  Maze class should have the following methods:
  1. `__init__(self, n, m)` - Initialize the maze grid with dimensions `n` x `m`.
  2. `solve_maze(self)` - Solve the maze and return the length of the path from start to end if a path exists, otherwise return an empty list.
  3. `_find_omega(self, i, j, value, result, start, end, found)` - A recursive helper method used by `solve_maze` to explore the grid.
  4. `_on_board(self, i, j)` - A helper method to check if a position `(i, j)` is within the bounds of the maze and is a valid path.
  
  assert create_maze_solver(4, 4).solve_maze() == [7], "Test 1"
  assert create_maze_solver(3, 3).solve_maze() == [3], "Test 2"
  assert create_maze_solver(2, 2).solve_maze() == [1], "Test 3"
  assert create_maze_solver(1, 1).solve_maze() == [0], "Test 4"
  assert create_maze_solver(3, 5).solve_maze() == [4], "Test 5"
output: def create_maze_solver(n, m):
      class Maze:
          def __init__(self, n, m):
              self.n = n
              self.m = m
              self.grid = [[0] * m for _ in range(n)]
          
          def solve_maze(self):
              start = (0, 0)
              end = (self.n - 1, self.m - 1)
              result = []
              found = [False]
              self._find_omega(0, 0, 0, result, start, end, found)
              return result if found[0] else []
          
          def _find_omega(self, i, j, value, result, start, end, found):
              if found[0]:
                  return
              if (i, j) == end:
                  result.append(value)
                  found[0] = True
                  return
              for di, dj in [(-1, 0), (1, 0), (0, -1), (0, 1)]:
                  ni, nj = i + di, j + dj
                  if self._on_board(ni, nj):
                      self._find_omega(ni, nj, value + 1, result, start, end, found)
          
          def _on_board(self, i, j):
              return 0 <= i < self.n and 0 <= j < self.m
      
      return Maze(n, m)