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.
It doesn't depend where you append the position into the deque - by appending to the beginning as opposed to the end we are doing BFS instead of DFS. Both would work in this case, but DFS will be much slower when the board is large and the goal is far from the start.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Castle on the Grid
You are viewing a single comment's thread. Return to all comments →
It doesn't depend where you append the position into the deque - by appending to the beginning as opposed to the end we are doing BFS instead of DFS. Both would work in this case, but DFS will be much slower when the board is large and the goal is far from the start.