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.
digital_root(spezial)
toreturn digital_root(spezial)
. You need to return the value and you are simply calling the function. Once the function has been called, there is no statement to return and retain the value; therefore "undefined" is returned (default value).var
before the variablei
. This doesn't effect this code, but makes the variable global which may affect your coding in the future if you don't include it (I've seen bugs before because of the lack of it).This comment is hidden because it contains spoiler information about the solution
I've left the issues open because they haven't been resolved. The author hasn't been on since February, so the author may fix it in due time. It gives you notifications if there is an issue, so the author can look at them when they get back; your comment wasn't marked as an issue so it's less likely that the author may see it also.
thanks for the answer. i'd already seen your reply in another comment but as tests aren't fixed yet i think it's good to relance the issue...
I'm quite confused by your comment. You might be using the coding structure wrong? You don't have to implement testcases since the Kata already has inbuilt testcases.
Mind if you post your code to this reply so I can see what's happening?
You're meant to return the final output, not print it to the console. Returning the value allow the yields the value, meaning the function call retains this value. The output can be checked for equality using testcases.
Read the comments next time.
In the Java testcases, the expected and the actual are swapped around, so your solution is returning 0 and the expected answer is 7.
Proven by the testcase
I get this result in the Python version as well.
This comment is hidden because it contains spoiler information about the solution
Yes, this code is inefficient.
My javascript code with non-optimal solution: Time: 412ms
My javascript code with optimal solution: Time: 301ms
My java code with optimal solution: Time: 42ms
Java: 16 expected 0 but it is 7. I am pretty sure it should be 7