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.
My solution is passing all of the test cases, but does not pass the falsifiable test. I'm certain that what I'm doing fits the given pattern, so I'm not quite sure what I'm missing.
Also, it is telling me
expected: 150
but got: 0
-3
Is that a (negative) 3 ? I tried using absolute value, which doesn't help.
There is no reason to keep the entire array around.
def fibonacci(n, arr=[0, 1])
return n if (0..1).include? n
return arr.reduce(&:+) if n == 2
fibonacci(n - 1, [arr[1], arr.reduce(&:+)])
end