input: Write a function to solve a maze using an object-oriented approach in Python. The function should define a class `Maze` that initializes a grid of size `n` by `m` and contains methods to solve the maze and find a path from the top-left corner to the bottom-right corner. Return the path length as a list if a solution is found, otherwise return an empty list.
  
  
  import collections
  
  class Maze:
      def __init__(self, n, m):
          self._n, self._m = n, m
          self._grid = [[1] * m for _ in range(n)]
  
      def solve_maze(self):
          result, found = [], False
          start, end = (0, 0), (self._n-1, self._m-1)
  
          for i in range(self._n):
              for j in range(self._m):
                  if self._grid[i][j] == 1:
                      value = 0
                      self._find_omega(i, j, value, result, start, end, found)
                      return result
  
      def _find_omega(self, i, j, value, result, start, end, found):
          rowNbr, colNbr = [-1, 0, 0, 1], [0, -1, 1, 0]
  
          if (i, j) == end:
              found = True
              result.append(value)
              return
  
          if found == True:
              return
  
          self._grid[i][j] = 0
          for k in range(4):
              if self._on_board(i + rowNbr[k], j + colNbr[k]):
                  self._find_omega(i + rowNbr[k], j + colNbr[k], value + 1, result, start, end, found)
  
      def _on_board(self, i, j):
          return 0 <= i < self._n and 0 <= j < self._m and self._grid[i][j] == 1
  
  # Test cases
  assert Maze(3, 3).solve_maze() == [4]
  assert Maze(2, 2).solve_maze() == [2]
  assert Maze(1, 1).solve_maze() == [0]
  assert Maze(3, 3).solve_maze() == [4]
  assert Maze(4, 4).solve_maze() == [6]
  
output: 
  import collections
  
  class Maze:
      def __init__(self, n, m):
          self._n, self._m = n, m
          self._grid = [[1] * m for _ in range(n)]
  
      def solve_maze(self):
          start, end = (0, 0), (self._n-1, self._m-1)
          queue = collections.deque([(start, 0)])
          visited = set()
          visited.add(start)
  
          while queue:
              (current_x, current_y), steps = queue.popleft()
  
              if (current_x, current_y) == end:
                  return [steps]
  
              for dx, dy in [(-1, 0), (1, 0), (0, -1), (0, 1)]:
                  new_x, new_y = current_x + dx, current_y + dy
                  if self._on_board(new_x, new_y) and (new_x, new_y) not in visited:
                      visited.add((new_x, new_y))
                      queue.append(((new_x, new_y), steps + 1))
  
          return []
  
      def _on_board(self, i, j):
          return 0 <= i < self._n and 0 <= j < self._m and self._grid[i][j] == 1
  