Rust BFS
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(N)\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nO(N}\n# Code\n```\nimpl Solution {\n    pub fn nearest_exit(maze: Vec<Vec<char>>, entrance: Vec<i32>) -> i32 {\n        let mut maze = maze;\n        let (m, n) = (maze.len(), maze[0].len());\n        \n        let mut q = vec![(entrance[0] as usize, entrance[1] as usize)];\n        let dirs = [[0, 1], [1, 0], [0, -1], [-1, 0]];\n        \n        maze[entrance[0] as usize][entrance[1] as usize] = \'+\';\n        let mut ret = 0;\n\n        while q.is_empty() == false {\n            let mut temp = vec![];\n            ret += 1;\n            for (u, v) in q {\n                for d in dirs {\n                    let (x, y) = (u as i32 + d[0], v as i32 + d[1]);\n                    if x < 0 || x == m as i32 || y < 0 || y == n as i32 { continue }\n\n                    let (x, y) = (x as usize, y as usize);\n                    if maze[x][y] == \'+\' { continue }\n                    \n                    if  x == 0 || x == m - 1 || y == 0 || y == n - 1 { return ret }\n                    \n                    maze[x][y] = \'+\';\n                    temp.push((x, y));\n                }\n            }\n            q = temp;\n        }\n        \n        -1\n    }\n}\n```
['Rust']