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 submitted my code knowing that it would time out. Besides throwing zeroes in between the given digits and starting at the ceiling of the square root of that number, I have no idea how to cut the problem down. My code is good up to 10 given digits but it will time out with most cases above that. Any hints as to how you can break the problem down further?
Edit: You can also disregard roots based on the last digit of the given digits. For example, last digit being 1 can only come from 1 or 9, last digit 4 can only come from 8 or 2.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #206: Concealed Square
You are viewing a single comment's thread. Return to all comments →
I submitted my code knowing that it would time out. Besides throwing zeroes in between the given digits and starting at the ceiling of the square root of that number, I have no idea how to cut the problem down. My code is good up to 10 given digits but it will time out with most cases above that. Any hints as to how you can break the problem down further?
Edit: You can also disregard roots based on the last digit of the given digits. For example, last digit being 1 can only come from 1 or 9, last digit 4 can only come from 8 or 2.