✅ Python, Easy to understand BFS, 97.74%
\nclass Solution:\n    def nearestExit(self, maze: List[List[str]], entr: List[int]) -> int:\n        rows, cols = len(maze), len(maze[0])\n        deq = deque(
```\nclass Solution:\n    def nearestExit(self, maze: List[List[str]], entr: List[int]) -> int:\n        rows, cols = len(maze), len(maze[0])\n        deq = deque()\n        deq.append([entr[0], entr[1], -1])\n        \n        while deq:\n            r, c, dist = deq.popleft()\n            if not (0 <= r < rows and 0 <= c < cols):\n                if dist > 0:\n                    return dist\n                continue\n            if maze[r][c] == \'+\':\n                continue\n            \n            maze[r][c] = \'+\'\n            for _r, _c in ((0, 1), (0, -1), (1, 0), (-1, 0)):\n                deq.append([r + _r, c + _c, dist + 1])\n        \n        return -1\n```\n\nTime Complexity - ```O(N * M)```, ```756``` ms, faster than ```97.74%```\nSpace \u0421omplexity - ```O(N * M)```, ```14.4``` MB, less than ```99.05%```
['Breadth-First Search', 'Python']