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.
I had runtime errors too, it's related to your data type not able to handle up to the required Input Constraint of 1e-100 (10 ^ 100). That is a huge number. I had to use a special BigInteger class in C#. Also, I have 4 test cases passing, but the rest timeout (3 seconds). My algorithm is O(n), which is obviously too slow for a loop on an input k such as 100,000,000,000,000,000,000.
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 →
I had runtime errors too, it's related to your data type not able to handle up to the required Input Constraint of 1e-100 (10 ^ 100). That is a huge number. I had to use a special BigInteger class in C#. Also, I have 4 test cases passing, but the rest timeout (3 seconds). My algorithm is O(n), which is obviously too slow for a loop on an input k such as 100,000,000,000,000,000,000.