Cody

Solution 405272

Submitted on 17 Feb 2014 by Anuj
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 = [7 10 6 4]; y_correct = 9; assert(isequal(your_fcn_name(x),y_correct))

S = 3 ans = 3 S = 7 ans = 4 S = 9 ans = 5 S = 9

2   Pass
%% x = [1 2 3 2]; y_correct = 3; assert(isequal(your_fcn_name(x),y_correct))

S = 1 ans = 3 S = 2 ans = 4 S = 3 ans = 5 S = 3

3   Pass
%% x = -5:5:30; y_correct = 35; assert(isequal(your_fcn_name(x),y_correct))

S = 5 ans = 3 S = 10 ans = 4 S = 15 ans = 5 S = 20 ans = 6 S = 25 ans = 7 S = 30 ans = 8 S = 35 ans = 9 S = 35

4   Pass
%% x = [45 -16 34 19 120]; y_correct = 227; assert(isequal(your_fcn_name(x),y_correct))

S = 61 ans = 3 S = 111 ans = 4 S = 126 ans = 5 S = 227 ans = 6 S = 227

Suggested Problems

More from this Author100