Cody

Solution 289530

Submitted on 25 Jul 2013 by Thomas Smith
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 = 0 g = 1 h = 1 f = 1 g = 1

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

f = 0 g = 1 h = 1 f = 1 g = 1 h = 2 f = 1 g = 2 h = 3 f = 2 g = 3 h = 5 f = 3 g = 5 h = 8 f = 5 g = 8 h = 13 f = 8 g = 13

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

f = 0 g = 1 h = 1 f = 1 g = 1 h = 2 f = 1 g = 2 h = 3 f = 2 g = 3 h = 5 f = 3 g = 5 h = 8 f = 5 g = 8 h = 13 f = 8 g = 13 h = 21 f = 13 g = 21 h = 34 f = 21 g = 34 h = 55 f = 34 g = 55 h = 89 f = 55 g = 89

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

f = 0 g = 1 h = 1 f = 1 g = 1 h = 2 f = 1 g = 2 h = 3 f = 2 g = 3 h = 5 f = 3 g = 5 h = 8 f = 5 g = 8 h = 13 f = 8 g = 13 h = 21 f = 13 g = 21 h = 34 f = 21 g = 34 h = 55 f = 34 g = 55 h = 89 f = 55 g = 89 h = 144 f = 89 g = 144 h = 233 f = 144 g = 233 h = 377 f = 233 g = 377 h = 610 f = 377 g = 610 h = 987 f = 610 g = 987 h = 1597 f = 987 g = 1597 h = 2584 f = 1597 g = 2584 h = 4181 f = 2584 g = 4181 h = 6765 f = 4181 g = 6765 h = 10946 f = 6765 g = 10946