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.
You are absolutely right Yousuf, the tail might be updated more than once. That's why I wrote "more than once usually". Assuming the above algorithm is followed, the probability that the same tail is updated more than once, is really low (can be confirmed by counting tail-updates for various test case). This is mentioned in the other comment that it has (very loose) upper bound of "number of other tail updates". Though, since tail is updated only when we take "lesser moves" in spite of going through snake, even single update isn't that probable. Glad to know that you felt good for the solution :)
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 →
You are absolutely right Yousuf, the tail might be updated more than once. That's why I wrote "more than once usually". Assuming the above algorithm is followed, the probability that the same tail is updated more than once, is really low (can be confirmed by counting tail-updates for various test case). This is mentioned in the other comment that it has (very loose) upper bound of "number of other tail updates". Though, since tail is updated only when we take "lesser moves" in spite of going through snake, even single update isn't that probable. Glad to know that you felt good for the solution :)