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.
I suspect this is why 12157692622039623539 wasn't included:
Javascript numbers just don't go that high, you'd need to use strings instead (which still wouldn't satisfy this kata because it tests for numbers).
This comment is hidden because it contains spoiler information about the solution
Yeah, but if the author were to add an if statement which started calculating only if the top of the range was very high, they could keep the advantage of speed whilst making their solution general purpose.
This comment is hidden because it contains spoiler information about the solution
Well, this just seems like a "cheat" solution.
how about "-10"?
I think it is up to you. The link is for better explanation.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
That's part of the challenge. You can write your own test cases to cover the edge cases not covered by the given ones. Some katas don't have default test cases at all. The tests are only there to assist you while solving the problem, and the submission is the final assessment of correctness. Like in the real world, you have to anticipate the data the user will input in your program and deal with all of it correctly. If the submission doesn't pass, it means your program isn't correct.
I think this kata needs a clarifications if matrices can be of different sizes.
Third test case is broken
Last test case is missing closing parentheses. Otherwise, nice kata
It's Ruby's "conditional assignment operator". It only assigns the value to a variable if it is nil (or false), otherwise it doesn't do anything. It is necessary in this case to preserve the values in @cache every time the fibonacci method is called. If it was a simple assignment operator, @cache would get an empty hash assigned to it when fibonacci is called, and the solution wouldn't work.