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
- Discussions

# Castle on the Grid

# Castle on the Grid

#### Sort by

recency

#### |

#### 32 Discussions

#### |

Please Login in order to post a comment

i solved by building a graph of points on the grid and calculating distance using dijkstra's algo

If you are using BFS, simply blocking the previously visited spots might not work, you can try to add it if its cost is less.

What if on a 3x3 grid without any 'x' and source = (0,0) dst=(1,1).. We can never reach 1,1 because every move will lead to a corner of 3x3 grid. Description is either incomplete or completely wrong ?

Using C#: