Cody

# Problem 12. Fibonacci sequence

Solution 1907430

Submitted on 21 Aug 2019 by Eugene Avrutin
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))

first = 1 second = 1 next = 1 f = 1

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

first = 1 second = 1 next = 1 next = 2 second = 1 first = 2 next = 3 second = 2 first = 3 next = 5 second = 3 first = 5 next = 8 second = 5 first = 8 f = 8

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

first = 1 second = 1 next = 1 next = 2 second = 1 first = 2 next = 3 second = 2 first = 3 next = 5 second = 3 first = 5 next = 8 second = 5 first = 8 next = 13 second = 8 first = 13 next = 21 second = 13 first = 21 next = 34 second = 21 first = 34 next = 55 second = 34 first = 55 f = 55

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

first = 1 second = 1 next = 1 next = 2 second = 1 first = 2 next = 3 second = 2 first = 3 next = 5 second = 3 first = 5 next = 8 second = 5 first = 8 next = 13 second = 8 first = 13 next = 21 second = 13 first = 21 next = 34 second = 21 first = 34 next = 55 second = 34 first = 55 next = 89 second = 55 first = 89 next = 144 second = 89 first = 144 next = 233 second = 144 first = 233 next = 377 second = 233 first = 377 next = 610 second = 377 first = 610 next = 987 second = 610 first = 987 next = 1597 second = 987 first = 1597 next = 2584 second = 1597 first = 2584 next = 4181 second = 2584 first = 4181 next = 6765 second = 4181 first = 6765 f = 6765