Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
It's highly unlikely that you will get anywhere if you do not use some very specific number theory theorem. I think you just need to do some more research, until you stumple upon some particular approach.
I am hitting timeout exception with n=661915703. I have tried solving the problem using DP + memoization and BFS. Both the solution are encountering same timeout issue. I am unable to identify whats wrong. Any pointers will be great.
Thanks.
it's most probably a bug in c++ version of the kata. please check if adding
include <cmath>
in your solution helps, even if you don't use it.What are these errors? I don't have these on my file. (C++)
In file included from main.cpp:7:
./tests.cpp:7:35: error: no member named 'sqrt' in namespace 'std'
return n == std::pow(int(std::sqrt(n)), 2);
~~~~~^
./tests.cpp:7:22: error: no member named 'pow' in namespace 'std'
return n == std::pow(int(std::sqrt(n)), 2);
~~~~~^
./tests.cpp:20:27: error: no member named 'sqrt' in namespace 'std'
int sqrt_n = int(std::sqrt(n));
~~~~~^
3 errors generated.
Assert::That(sum_of_squares(661915703), Equals(4));
I am using C++ to attempt this problem.
It would be good if you stated the langauge you are attempting, it would help us to check tests.
You can also read this paragraph: https://docs.codewars.com/training/troubleshooting#print-input and the one directly following it.
For SumsOfPerfectSquares problem, all my test-cases are passing expect "maximally_hard_test_case1". This test-case is failing with time-out error. Is there a way to find which test in this test-set is failing?