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.
Well, this just seems like a "cheat" solution.
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.