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.
We are mutating (reducing) the items arrays' length every time we execute splice method.
Modulo is used to check if our index value is bigger than an arrays' length.
If it is we just use the remainder as an index, because it goes at the begining of an array again.
Think of it like a circle, it will go back to where it began.
This comment is hidden because it contains spoiler information about the solution
I have no idea how the tail call optimization could help here, but there are similar katas already:
http://www.codewars.com/kata/the-millionth-fibonacci-kata
http://www.codewars.com/kata/memoized-fibonacci
Yes I can :) When n >= 137, the two methods give different results. The difference however is very small, between 10^-15 and 10^-16 for all n between 150 and 200.
Thanks! I'm interested in what values of n that the values start being rounded. Can you give me some examples to test out?
This comment is hidden because it contains spoiler information about the solution