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.
There is a better solution. My machine computes the answer for n=100 in less than 4 seconds. If you want to test it the answer is
"Range: 7412080755407363 Average: 4323892498073.29 Median: 1859362246.00"
You lose precision because of
double
's involved. A workaround for anO(1)
solution would be not to dopow(n, 4)
, but find another approach, so you don't end up with very big floats. Otherwise rewrite your solution in language with arbitrary integer size.You're probably having an integer overflow.
Given the only language he trained is C++ I guess that's the language.
Looks like expected and actual results are swapped in error message. Which language are you using?
It's just how the tests are written. It certainly could have been written to accept another type of data format. I thought it was sort of an odd choice myself.