Cody

# Problem 2390. Fair Scoring for Cody

Solution 462917

Submitted on 26 Jun 2014 by George Berken
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
%% newline = char(10); s = ['function testStr2Num(s)' newline... 'str2num(''1'')']; y_correct = 9; assert(isequal(fair_score(s),y_correct))

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

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

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

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

6   Pass
%% 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))

### Community Treasure Hunt

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

Start Hunting!