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.
Is this Kata especially hard in Ruby because Ruby is slow? I have optimized and optimized and my code still isn't fast enough.
short solution using core lib only
Performance Version
This method only checks whether there already is a memo the first time it is called. Then the method redifines itself, and further calls retrieve the (instance variable) memo directly, without perfoming the check. Since the check doesn't need to happen every time the method is called, it should have better performance (and performance is the point of doing memoization in the first place)