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.
That is, take some amount of s (try a few examples, like 21, 22, 40, 41, 42, 61 hint hint) and see how far you go.
Even further, think about how, if you have gotten to square 42, you get to square 44, what is the next multiple of 42 you'll reach? How much strength is required to get there from 44 (what square will you actually end on whith that exact amount of strength?). Does a pattern emerge after that? Remember, this is a math problem; doing it iteratively is wasteful.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Wet Shark and 42
You are viewing a single comment's thread. Return to all comments →
This can be thought of as a fenceposting issue.
That is, take some amount of s (try a few examples, like 21, 22, 40, 41, 42, 61 hint hint) and see how far you go.
Even further, think about how, if you have gotten to square 42, you get to square 44, what is the next multiple of 42 you'll reach? How much strength is required to get there from 44 (what square will you actually end on whith that exact amount of strength?). Does a pattern emerge after that? Remember, this is a math problem; doing it iteratively is wasteful.