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.
This comment is hidden because it contains spoiler information about the solution
I had broken this same solution up into two parts. Great to know it could be done like this.
How does the solution have to call a more complicated function? sum() is not more complicated than your solution--it eventually resolves to a while loop that simply loops over the iterable, accumulating the sum along the way, and then returns it. Your solution, on the other hand, recursively calls itself n-1 times, setting up a new stack frame each time, and consuming n frames on the stack, which is resource-intensive in both time and space. Your solution isn't even tail recursive, so tail call optimization cannot be used to reduce these costs.
not seem to be a good answer ,(although short)as it has to recall a more complicat function which takes more resource
No need to replace "0" with "0"
spoiler flag...
This comment is hidden because it contains spoiler information about the solution
I have forgotten regExp^)
This has to me a lot...not on blues but yellows should be giving 8...been getting 2.
no curly brackets, no print in ruby it's puts(don't need it for this problem)
https://ruby-doc.org/core-2.2.2/Integer.html#method-i-times