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.
ivanightingale, what is wrong with that?
I like the "why break at all if you can return the result straight away?" People should try it out before they say something.
Why can't you return the result straight away using break?
why break at all if you can return the result straight away?
The formula takes a lot less time than recursion or loops for really big numbers as far as I know. Also, the formula only gives integer outputs for intger inputs (the coefficient on the sqrt(5) term always ends up as 0). I think ths formula is a lot more efficient, however there might be an accuracy issue due to the use of doubles, but I never experienced such problems.