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.
Yes, but Dijkstra is more easier to run on this problem, simply provide the snakes as posivitive weight and ladders as negative weight, and run dijkstra, making the graph suitable for bfs takes a bit of work.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Snakes and Ladders: The Quickest Way Up
You are viewing a single comment's thread. Return to all comments →
Yes, but Dijkstra is more easier to run on this problem, simply provide the snakes as posivitive weight and ladders as negative weight, and run dijkstra, making the graph suitable for bfs takes a bit of work.