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.
"getting caught by a snake is always unfavorable, and will not add to the progress of a short path"
This does not seem to be accurate. Suppose a ladder is from 2 to 82, a snake is from 84 to 62 and another ladder is from 62 to 99 and nothing else, the optimal solution is to take the ladder to 82, then the snake from 84 to 62 and then take the ladder from 62 to 99.
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 →
"getting caught by a snake is always unfavorable, and will not add to the progress of a short path"
This does not seem to be accurate. Suppose a ladder is from 2 to 82, a snake is from 84 to 62 and another ladder is from 62 to 99 and nothing else, the optimal solution is to take the ladder to 82, then the snake from 84 to 62 and then take the ladder from 62 to 99.