Test  Status  Code Input and Output 

1  Pass 
% This Test Suite can be updated if inappropriate 'hacks' are discovered
% in any submitted solutions, so your submission's status may therefore change over time.
assessFunctionAbsence({'regexp', 'regexpi', 'str2num'}, 'FileName','latestScore.m')
RE = regexp(fileread('latestScore.m'), '\w+', 'match');
tabooWords = {'ans'};
testResult = cellfun( @(z) ismember(z, tabooWords), RE );
msg = ['Please do not do that in your code!' char([10 13]) ...
'Found: ' strjoin(RE(testResult)) '.' char([10 13]) ...
'Banned word.' char([10 13])];
assert(~any( testResult ), msg)

2  Pass 
N = 11;
R = 2.5;
R_new = 2.2;
S = latestScore(N, R, R_new);
assert( isempty(S) )

3  Pass 
N = 11;
R = 2.5;
R_new = 2.3;
S = latestScore(N, R, R_new);
S_correct = 1;
assert(isequal(S, S_correct))

4  Pass 
N = 11;
R = 2.5;
R_new = 2.4;
S = latestScore(N, R, R_new);
S_correct = [1 2];
assert(isequal(S, S_correct))

5  Pass 
N = 11;
R = 2.5;
R_new = 2.5;
S = latestScore(N, R, R_new);
S_correct = [2 3];
assert(isequal(S, S_correct))

6  Pass 
N = 11;
R = 2.5;
R_new = 2.6;
S = latestScore(N, R, R_new);
S_correct = [3 4];
assert(isequal(S, S_correct))

7  Pass 
N = 11;
R = 2.5;
R_new = 2.7;
S = latestScore(N, R, R_new);
S_correct = [4 5];
assert(isequal(S, S_correct))

8  Pass 
N = 11;
R = 2.5;
R_new = 2.8;
S = latestScore(N, R, R_new);
S_correct = 5;
assert(isequal(S, S_correct))

9  Pass 
N = 11;
R = 2.5;
R_new = 2.9;
S = latestScore(N, R, R_new);
assert( isempty(S) )

10  Pass 
N = 12;
R = 2.3;
R_new = 2.2;
S = latestScore(N, R, R_new);
S_correct = [1 2];
assert(isequal(S, S_correct))

11  Pass 
N = 12;
R = 2.3;
R_new = 2.5;
S = latestScore(N, R, R_new);
S_correct = [4 5];
assert(isequal(S, S_correct))

12  Pass 
N = 17;
R = 1.6;
R_new = 1.7;
S = latestScore(N, R, R_new);
S_correct = [2 3 4];
assert(isequal(S, S_correct))

13  Pass 
N = 17;
R = 2.6;
R_new = 2.5;
S = latestScore(N, R, R_new);
S_correct = 1;
assert(isequal(S, S_correct))

14  Pass 
N = 17;
R = 2.6;
R_new = 2.7;
S = latestScore(N, R, R_new);
S_correct = [3 4 5];
assert(isequal(S, S_correct))

15  Pass 
N = 17;
R = 2.6;
R_new = 2.8;
S = latestScore(N, R, R_new);
S_correct = 5;
assert(isequal(S, S_correct))

16  Pass 
N = 17;
R = 3.4;
R_new = 3.2;
S = latestScore(N, R, R_new);
S_correct = 1;
assert(isequal(S, S_correct))

17  Pass 
N = 17;
R = 3.4;
R_new = 3.3;
S = latestScore(N, R, R_new);
S_correct = [1 2 3];
assert(isequal(S, S_correct))

18  Pass 
N = 17;
R = 3.4;
R_new = 3.5;
S = latestScore(N, R, R_new);
S_correct = 5;
assert(isequal(S, S_correct))

19  Pass 
N = 48;
R = 3.7;
R_new = 3.5;
S = latestScore(N, R, R_new);
assert( isempty(S) )

20  Pass 
N = 48;
R = 3.7;
R_new = 3.6;
S = latestScore(N, R, R_new);
S_correct = [1 2];
assert(isequal(S, S_correct))

21  Pass 
N = 48;
R = 3.7;
R_new = 3.7;
S = latestScore(N, R, R_new);
S_correct = 1:5;
assert(isequal(S, S_correct))

22  Pass 
N = 48;
R = 3.7;
R_new = 3.8;
S = latestScore(N, R, R_new);
S_correct = 5;
assert(isequal(S, S_correct))

23  Pass 
N = 48;
R = 4.4;
R_new = 4.2;
S = latestScore(N, R, R_new);
S_correct = 1:4;
assert( isempty(S) )

24  Pass 
N = 48;
R = 4.4;
R_new = 4.3;
S = latestScore(N, R, R_new);
S_correct = 1:4;
assert(isequal(S, S_correct))

25  Pass 
N = 48;
R = 4.4;
R_new = 4.4;
S = latestScore(N, R, R_new);
S_correct = 1:5;
assert(isequal(S, S_correct))

26  Pass 
N = 48;
R = 4.4;
R_new = 4.5;
S = latestScore(N, R, R_new);
assert( isempty(S) )

Remove the polynomials that have positive real elements of their roots.
589 Solvers
175 Solvers
Sort numbers by outside digits
125 Solvers
222 Solvers
212 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!