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 can use a much less 'clever' solution with a deterministic limit by pre-calculating the maximum product of integer division (ie floor) of input//3, input//5. It only uses 2 division operations. All the rest are multiplication. The slowest tests are .1s but Javascript isn't exactly optimized for raw calculation performance.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Sherlock and The Beast
You are viewing a single comment's thread. Return to all comments →
You can use a much less 'clever' solution with a deterministic limit by pre-calculating the maximum product of integer division (ie floor) of input//3, input//5. It only uses 2 division operations. All the rest are multiplication. The slowest tests are .1s but Javascript isn't exactly optimized for raw calculation performance.