input: Write a function to create an object-oriented structure in Python that solves a maze by implementing the Maze class, which initializes the maze dimensions and includes a method to solve the maze. The solve_maze method should find the path from the top-left corner to the bottom-right corner of the maze, represented by the grid, where a value of 1 indicates a traversable cell and 0 indicates a blocked cell. The function should return the path length if a solution is found, otherwise it should return an empty list.
  
  
  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
  
  
  assert Maze(4, 4).solve_maze() == [15]
  assert Maze(3, 3).solve_maze() == [8]
  assert Maze(2, 2).solve_maze() == [3]
  assert Maze(1, 1).solve_maze() == [0]
  assert Maze(5, 5).solve_maze() == [24]
output: 
  def solve_maze(self):
      def dfs(x, y, path_length):
          if (x, y) == (self._n-1, self._m-1):
              return path_length
          self._grid[x][y] = 0
          for dx, dy in [(-1, 0), (1, 0), (0, -1), (0, 1)]:
              nx, ny = x + dx, y + dy
              if 0 <= nx < self._n and 0 <= ny < self._m and self._grid[nx][ny] == 1:
                  result = dfs(nx, ny, path_length + 1)
                  if result is not None:
                      return result
          self._grid[x][y] = 1
          return None
  
      path_length = dfs(0, 0, 0)
      return [path_length] if path_length is not None else []
  