Cody

Problem 12. Fibonacci sequence

Solution 1835611

Submitted on 3 Jun 2019 by Yashasvi
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
n = 1; f = 1; assert(isequal(fib(n),f))

f = 1

2   Pass
n = 6; f = 8; assert(isequal(fib(n),f))

t = 2 r = 1 s = 2 t = 3 r = 2 s = 3 t = 5 r = 3 s = 5 t = 8 r = 5 s = 8 t = 13 r = 8 s = 13 f = 8

3   Pass
n = 10; f = 55; assert(isequal(fib(n),f))

t = 2 r = 1 s = 2 t = 3 r = 2 s = 3 t = 5 r = 3 s = 5 t = 8 r = 5 s = 8 t = 13 r = 8 s = 13 t = 21 r = 13 s = 21 t = 34 r = 21 s = 34 t = 55 r = 34 s = 55 t = 89 r = 55 s = 89 f = 55

4   Pass
n = 20; f = 6765; assert(isequal(fib(n),f))

t = 2 r = 1 s = 2 t = 3 r = 2 s = 3 t = 5 r = 3 s = 5 t = 8 r = 5 s = 8 t = 13 r = 8 s = 13 t = 21 r = 13 s = 21 t = 34 r = 21 s = 34 t = 55 r = 34 s = 55 t = 89 r = 55 s = 89 t = 144 r = 89 s = 144 t = 233 r = 144 s = 233 t = 377 r = 233 s = 377 t = 610 r = 377 s = 610 t = 987 r = 610 s = 987 t = 1597 r = 987 s = 1597 t = 2584 r = 1597 s = 2584 t = 4181 r = 2584 s = 4181 t = 6765 r = 4181 s = 6765 t = 10946 r = 6765 s = 10946 f = 6765