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.
Not so easy task. It can be solved using clever dynamic programming, focusing on digit by digit processing. Search space should be defined by the maximum value of square digit sum. For given square digit sum we also need to keep track of its frequency. Maximum time is around 50 ms for values of k in the order of 10^100.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #171: Finding numbers for which the sum of the squares of the digits is a square
You are viewing a single comment's thread. Return to all comments →
Not so easy task. It can be solved using clever dynamic programming, focusing on digit by digit processing. Search space should be defined by the maximum value of square digit sum. For given square digit sum we also need to keep track of its frequency. Maximum time is around 50 ms for values of k in the order of 10^100.