↧
Answer by Graipher for BFS shortest path for Google Foobar "Prepare the...
One problem might be your custom Queue class. The list you use as underlying data structure has O(n) behaviour for list.insert(0, item). It would be better to use a collections.deque, for which...
View ArticleBFS shortest path for Google Foobar "Prepare the Bunnies' Escape"
This is the Google Foobar puzzle "Prepare the Bunnies' Escape":You have maps of parts of the space station, each starting at a prison exit and ending at the door to an escape pod. The map is...
View ArticleAnswer by Anirudh Goel for BFS shortest path for Google Foobar "Prepare the...
The approach followed by the question poster and also in the other answers use BFS in a loop to find the answer. If there're a lot of walls that cannot be passed, the time complexity can get quite...
View Article