Cody

Solution 2024705

Submitted on 17 Nov 2019 at 4:05 by Luu Van Duc
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
x = [1 4 5 7 10 11 13 20 21 23 29]; y_correct = 4; assert(isequal(fib_count(x),y_correct))

b = [] b = 1 h = 1 h = 2 b = 1 4 h = 3 b = 1 4 5 h = 4 b = 1 4 5 7 h = 5 b = 1 4 5 7 10 h = 6 b = 1 4 5 7 10 11 h = 7 b = 1 4 5 7 10 11 13 h = 8 b = 1 4 5 7 10 11 13 20 h = 9 b = 1 4 5 7 10 11 13 20 21 h = 10 b = 1 4 5 7 10 11 13 20 21 23 h = 11 b = 1 4 5 7 10 11 13 20 21 23 29 y = 0 y = 1 y = 2 y = 3 y = 4

2   Pass
x = 5:5:100; y_correct = 2; assert(isequal(fib_count(x),y_correct))

b = [] b = 5 h = 1 h = 2 b = 5 10 h = 3 b = 5 10 15 h = 4 b = 5 10 15 20 h = 5 b = 5 10 15 20 25 h = 6 b = 5 10 15 20 25 30 h = 7 b = 5 10 15 20 25 30 35 h = 8 b = 5 10 15 20 25 30 35 40 h = 9 b = 5 10 15 20 25 30 35 40 45 h = 10 b = 5 10 15 20 25 30 35 40 45 50 h = 11 b = 5 10 15 20 25 30 35 40 45 50 55 h = 12 b = 5 10 15 20 25 30 35 40 45 50 55 60 h = 13 b = 5 10 15 20 25 30 35 40 45 50 55 60 65 h = 14 b = 5 10 15 20 25 30 35 40 45 50 55 60 65 70 h = 15 b = 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 h = 16 b = 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 h = 17 b = 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 h = 18 b = 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 h = 19 b = 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 h = 20 b = 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 y = 0 y = 1 y = 2

3   Pass
%x = [2 2 3 3 3 3 3 3 5 5 6 6 6 7 86168291600238450732788312165664788095941068326060883324529903470149056115823592713458328176574447204501]; % Changed the test suite to a number that can be represented as an integer in DOUBLE x = [2 2 3 3 3 3 3 3 5 5 6 6 6 7 8944394323791465]; y_correct = 3; assert(isequal(fib_count(x),y_correct))

b = [] b = 2 h = 1 h = 2 b = 2 3 h = 3 b = 2 3 5 h = 4 b = 2 3 5 6 h = 5 b = 2 3 5 6 7 h = 6 b = 1.0e+15 * 0.0000 0.0000 0.0000 0.0000 0.0000 8.9444 y = 0 y = 1 y = 2 y = 3

4   Pass
x = [2 2 3 3 3 3 3 3 5 5 6 6 6 7 8944394323791464]; y_correct = 4; assert(isequal(fib_count(x),y_correct))

b = [] b = 2 h = 1 h = 2 b = 2 3 h = 3 b = 2 3 5 h = 4 b = 2 3 5 6 h = 5 b = 2 3 5 6 7 h = 6 b = 1.0e+15 * 0.0000 0.0000 0.0000 0.0000 0.0000 8.9444 y = 0 y = 1 y = 2 y = 3 y = 4