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.
Yes, that is true. It should be j<=sqrt(i).
should be j <= sqrt(i)?
why would that make a diff, absolute size is meaningless. its about the geom of the input.
time squaresums.sh 100000 -> 1, 2, 4, 13, 447, 99999 == real 0m0.028s
time squaresums.sh 1000000000000 -> 5, 22, 1261, 1414213, 999999999999 == real 0m0.023s
This was a great kata, I actually spent a week on it (was much harder than most 5th kyu that I've done!). I had decided to use the C++
list
type, because, oh I don't know, I guess I thought thesort()
remove()
andunique()
functions would be useful. But while submitting I learned that the code was timing out before completing the tests. Turns out,list
is too inefficient. I changed my type tovector
and everything was gravy.This is another case where I strongly recommend adding one of the big test cases to the sample test case section...
Agree, regarding the benefits of "figuring" it out. Sometimes it's more of a challenge than the kata itself and can be a real headache, but I've found I learn more about the C++ language as a whole (in terms of its quirks and intracacies) when I finally get through it
Nice Kata. My first attempt at a recursive solution passed the example tests but failed the first submission because it blew the stack for a large 'n'. (which was a flaw in my design).
I think this kata could be improved by adding a test for large 'n' to the example tests. For C++, add:
This kata presents a wonderful training experience in extracting software requirements from poorly written guidelines. That may sound snarky, but this is a real skill that is worth exercising.
However, the output format presented in the description does not match the inputs to the C++ unit tests. This really should be fixed.
The C++ unit tests won't run, as they don't cite the 'std' namespace anywhere... but this is fine; if anything this will coerce users into modifying the unit tests (which we should be doing anyway).
Same problem in C++... but then I read the instructions more carefully. Check your inputs, folks.
This comment is hidden because it contains spoiler information about the solution
Nice!
Oh derp, 'while( 0 < n )' is a conditional expression