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.
Has anybody got a link to the mathematical theory behind this problem? Individually testing each number in the number range just doesn't cut the mustard.
I even pruned the coin list by deleting all multiples from it (if a price is divisible by 10 then it is also divisible by 2 or 5 so the 10 is not needed) but with up to 10^20 sets of prices, just running an empty loop would probably cause a timeout.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Mehta and the Typical Supermarket
You are viewing a single comment's thread. Return to all comments →
Has anybody got a link to the mathematical theory behind this problem? Individually testing each number in the number range just doesn't cut the mustard.
I even pruned the coin list by deleting all multiples from it (if a price is divisible by 10 then it is also divisible by 2 or 5 so the 10 is not needed) but with up to 10^20 sets of prices, just running an empty loop would probably cause a timeout.