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.
Project Euler #87: Prime power triples
Project Euler #87: Prime power triples
Sort by
recency
|
16 Discussions
|
Please Login in order to post a comment
Python 3: Passed all the tests
Hint: this problem works with brute-force. Run 3 loops for i in (1:3163), for j in (1:216), and for k in (1:57)
Hello everyone, Nice problem and good job for hackerrank but like euler problems I solved before, I spent basically 30 minutes getting an answer to the Euler problem + 30 minutes figuring out how to handle the many test cases (i.e, my code works for T = 1 and N = 50 * 10 ** 7, let's make it work for large T and N = 10 ** 7).
What do you think of that feature for hackerrank problem (making you think on how to handle a large number of cases) ?
Is it a necessary evil so that cheater / people who program something not generic enough can't solve the problem and get the 100 points ? is it a good thing to enhance one's programming skills ? it's just a bad thing ?
this is my code... it ran fine upto 10^8 on codechef. don't knw why hackerrank can't run it after around 835000... pls help
Earlier I tried with
bisect
,ans += index + 1
and thenbreak
, but the issue here is with duplicates. It seems all solutions here are sort of brute force with sets to remove duplicates, and it is alwaysans += 1
in the counting itself. I wonder if there could be any dynamic programming involved in it.