Cody

# Problem 12. Fibonacci sequence

Solution 1840429

Submitted on 6 Jun 2019 by Chinmay Anand
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))

pre = 1 prepre = 1 ans = 2 prepre = 1 pre = 2 ans = 3 prepre = 2 pre = 3 ans = 5 prepre = 3 pre = 5 ans = 8 prepre = 5 pre = 8 f = 8

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

pre = 1 prepre = 1 ans = 2 prepre = 1 pre = 2 ans = 3 prepre = 2 pre = 3 ans = 5 prepre = 3 pre = 5 ans = 8 prepre = 5 pre = 8 ans = 13 prepre = 8 pre = 13 ans = 21 prepre = 13 pre = 21 ans = 34 prepre = 21 pre = 34 ans = 55 prepre = 34 pre = 55 f = 55

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

pre = 1 prepre = 1 ans = 2 prepre = 1 pre = 2 ans = 3 prepre = 2 pre = 3 ans = 5 prepre = 3 pre = 5 ans = 8 prepre = 5 pre = 8 ans = 13 prepre = 8 pre = 13 ans = 21 prepre = 13 pre = 21 ans = 34 prepre = 21 pre = 34 ans = 55 prepre = 34 pre = 55 ans = 89 prepre = 55 pre = 89 ans = 144 prepre = 89 pre = 144 ans = 233 prepre = 144 pre = 233 ans = 377 prepre = 233 pre = 377 ans = 610 prepre = 377 pre = 610 ans = 987 prepre = 610 pre = 987 ans = 1597 prepre = 987 pre = 1597 ans = 2584 prepre = 1597 pre = 2584 ans = 4181 prepre = 2584 pre = 4181 ans = 6765 prepre = 4181 pre = 6765 f = 6765