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.
Should we use a stack or a queue? I think either would work, but not sure which would be faster. In my solution, the thing I pushed onto the queue was the node (x, y position) plus the, number of intersection encountered to have reached that point.
In the case that there are multiple routes to the final point, it might be more complicated.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Count Luck
You are viewing a single comment's thread. Return to all comments →
Should we use a stack or a queue? I think either would work, but not sure which would be faster. In my solution, the thing I pushed onto the queue was the node (x, y position) plus the, number of intersection encountered to have reached that point.
In the case that there are multiple routes to the final point, it might be more complicated.