From a96b65cbfad7f62f3db6b2eab105e4e25c0414c5 Mon Sep 17 00:00:00 2001 From: Jack Sangdahl Date: Fri, 27 Jun 2025 12:23:02 -0600 Subject: chore: remove old cpp and rust solutions --- other/nearest_exit_maze.cpp | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 other/nearest_exit_maze.cpp (limited to 'other/nearest_exit_maze.cpp') diff --git a/other/nearest_exit_maze.cpp b/other/nearest_exit_maze.cpp deleted file mode 100644 index 2e0a4cf..0000000 --- a/other/nearest_exit_maze.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include "leetcode.h" - -class Solution { -public: - int nearestExit(vvd(char) & maze, vector &entrance) { - int m = maze.size(), n = maze[0].size(); - int dirs[5] = {0, -1, 0, 1, 0}; - auto isExit = [&](int i, int j) -> int { - return (i != entrance[0] || j != entrance[1]) && - (i * j == 0 || i == m - 1 || j == n - 1); - }; - deque> dqa = {{entrance[0], entrance[1], 0}}; - while (!dqa.empty()) { - auto [i, j, s] = dqa.front(); - dqa.pop_front(); - for (int d = 0; d < 4; ++d) { - int i2 = i + dirs[d]; - int j2 = j + dirs[d + 1]; - if (i2 < 0 || i2 >= m || j2 < 0 || j2 >= n || maze[i2][j2] == '+') - continue; - maze[i2][j2] = '+'; - if (isExit(i2, j2)) - return s + 1; - dqa.push_back({i2, j2, s + 1}); - } - } - return -1; - } -}; - -int main() { - Solution obj; - vvd(char) - maze = {{'+', '+', '.', '+'}, {'.', '.', '.', '+'}, {'+', '+', '+', '.'}}; - vector entrance = {1, 2}; - cout << obj.nearestExit(maze, entrance); -} -- cgit v1.2.3