Cody

# Problem 2390. Fair Scoring for Cody

Solution 1101381

Submitted on 10 Jan 2017
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   Fail
newline = char(10); s = ['function testStr2Num(s)' newline... 'str2num(''1'')']; y_correct = 9; assert(isequal(fair_score(s),y_correct))

Undefined function 'fair_score' for input arguments of type 'char'. Error in TestPoint1 (line 5) assert(isequal(fair_score(s),y_correct))

2   Pass
% newline = char(10); %s = ['function testStr2Num(s)' newline... %'str2num(''1 2 3'')']; %y_correct = 11; %assert(isequal(fair_score(s),y_correct))

3   Fail
newline = char(10); s = ['function testRegexp(s)' newline... 'regexp(s,''(\d)'');']; y_correct = 10; assert(isequal(fair_score(s),y_correct))

Undefined function 'fair_score' for input arguments of type 'char'. Error in TestPoint3 (line 5) assert(isequal(fair_score(s),y_correct))

4   Fail
newline = char(10); s = ['function testRegexp(s)' newline... 'regexp(s,''(.{2,}).?(??@fliplr(\$1))'');']; y_correct = 14; assert(isequal(fair_score(s),y_correct))

Undefined function 'fair_score' for input arguments of type 'char'. Error in TestPoint4 (line 5) assert(isequal(fair_score(s),y_correct))

5   Fail
newline = char(10); s = ['function ans = testRegexprep(s)' newline... 'regexprep(s,''(\d)'',''A'');']; y_correct = 12; assert(isequal(fair_score(s),y_correct))

Undefined function 'fair_score' for input arguments of type 'char'. Error in TestPoint5 (line 5) assert(isequal(fair_score(s),y_correct))

6   Fail
newline = char(10); s = ['function ans = cellSourceIndex(C)' newline... 'str2num(regexprep(num2str(1:numel(C)),''(\d)'',''\${num2str(repmat(str2num(\$1),1,length(C{str2num(\$1)})))}''));']; y_correct = 36; assert(isequal(fair_score(s),y_correct))

Undefined function 'fair_score' for input arguments of type 'char'. Error in TestPoint6 (line 5) assert(isequal(fair_score(s),y_correct))

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!