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.
Really interesting problem. Although at first time I need to run manually to check the patterns. Anyway, this can be solved without calculating the power at all. My code finishes all of test case with 0s. You just need to know the minimum of X, which if X^n will have number of digits more than n. You just need to calculate between [1..X-1] and calculate based on input n.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #63: Powerful digit counts
You are viewing a single comment's thread. Return to all comments →
Really interesting problem. Although at first time I need to run manually to check the patterns. Anyway, this can be solved without calculating the power at all. My code finishes all of test case with 0s. You just need to know the minimum of X, which if X^n will have number of digits more than n. You just need to calculate between [1..X-1] and calculate based on input n.