We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Castle on the Grid
Castle on the Grid
Sort by
recency
|
327 Discussions
|
Please Login in order to post a comment
We don't necessarily need to build a graph. We can use a queue directly. Here is my Python solution:
Python 3 solution with a Graph and BFS.
include
include
include
using namespace std;
int minimumMoves(vector& grid, int startX, int startY, int goalX, int goalY) { int n = grid.size(); vector> ds = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}}; vector> visited(n, vector(n, false));
}
int main() { int n; cin >> n;
}