Test | Status | Code Input and Output |
---|---|---|
1 | Fail |
txt = 'I love MATLAB and Cody, but I don''t like trivial matlab problems on cody.';
words = {'and';'but';'Cody';'don''t';'I';'like';'love';'MATLAB';'on';'problems';'trivial'};
count = [1; 1; 2; 1; 2; 1; 1; 2; 1; 1; 1];
[words1,count1] = wordscount(txt);
assert(isequal(lower(words1),lower(words))&isequal(count,count1))
c =
'i love matlab and cody but i don't like trivial matlab problems on cody'
d =
1×14 cell array
{'i'} {'love'} {'matlab'} {'and'} {'cody'} {'but'} {'i'} {'don't'} {'like'} {'trivial'} {'matlab'} {'problems'} {'on'} {'cody'}
e =
1×11 cell array
{'and'} {'but'} {'cody'} {'don't'} {'i'} {'like'} {'love'} {'matlab'} {'on'} {'problems'} {'trivial'}
|
2 | Fail |
txt = sprintf('I love MATLAB and Cody, but I don''t like trivial matlab problems on cody.\n\nUnfortunately, there are too many trivial problems on Cody.');
words = {'and';'are';'but';'cody';'don''t';'I';'like';'love';'many';'matlab';'on';'problems';'there';'too';'trivial';'unfortunately'};
count = [1; 1; 1; 3; 1; 2; 1; 1; 1; 2; 2; 2; 1; 1; 2; 1];
[words1,count1] = wordscount(txt);
assert(isequal(lower(words1),lower(words))&isequal(count,count1))
c =
'i love matlab and cody but i don't like trivial matlab problems on cody
unfortunately there are too many trivial problems on cody'
d =
1×23 cell array
Columns 1 through 14
{'i'} {'love'} {'matlab'} {'and'} {'cody'} {'but'} {'i'} {'don't'} {'like'} {'trivial'} {'matlab'} {'problems'} {'on'} {'cody'}
Columns 15 through 23
{'unfortunately'} {'there'} {'are'} {'too'} {'many'} {'trivial'} {'problems'} {'on'} {'cody'}
e =
1×16 cell array
Columns 1 through 14
{'and'} {'are'} {'but'} {'cody'} {'don't'} {'i'} {'like'} {'love'} {'many'} {'matlab'} {'on'} {'problems'} {'there'} {'too'}
Columns 15 through 16
{'trivial'} {'unfortunately'}
|
3 | Fail |
txt = ['What is Cody? ',newline,' Cody is a MATLAB Central game', newline ...
'that expands your knowledge of MATLAB.',newline,...
'With Cody, you can:',newline, ...
'Solve problems related to MATLAB code;',newline, ...
'Find problems, solutions, and players; ',newline, ...
'Use search directives to find content; ',newline, ...
'Challenge the community by contributing problems;',newline, ...
' Comment on any problem or solution;',newline,...
'Like a problem or a solution; ',newline, ...
'Earn badges;',newline,newline, ...
'Play now!'];
words = {'a';'and';'any';'badges';'by';'can';'central';'challenge';'code';'cody';'comment';...
'community';'content';'contributing';'directives';'earn';'expands';'find';'game';...
'is';'knowledge';'like';'matlab';'now';'of';'on';'or';'play';'players';'problem';...
'problems';'related';'search';'solution';'solutions';'solve';'that';'the';'to';...
'use';'what';'with';'you';'your'};
count = [3;1;1;1;1;1;1;1;1;3;1;1;1;1;1;1;1;2;1;2;1;1;3;1;1;1;2;1;1;2;3;1;1;2;1;1;1;1;2;1;1;1;1;1];
[words1,count1] = wordscount(txt);
assert(isequal(lower(words1),lower(words))&isequal(count,count1))
c =
'what is cody
cody is a matlab central game
that expands your knowledge of matlab
with cody you can
solve problems related to matlab code
find problems solutions and players
use search directives to find content
challenge the community by contributing problems
comment on any problem or solution
like a problem or a solution
earn badges
play now'
d =
1×58 cell array
Columns 1 through 14
{'what'} {'is'} {'cody'} {'cody'} {'is'} {'a'} {'matlab'} {'central'} {'game'} {'that'} {'expands'} {'your'} {'knowledge'} {'of'}
Columns 15 through 27
{'matlab'} {'with'} {'cody'} {'you'} {'can'} {'solve'} {'problems'} {'related'} {'to'} {'matlab'} {'code'} {'find'} {'problems'}
Columns 28 through 40
{'solutions'} {'and'} {'players'} {'use'} {'search'} {'directives'} {'to'} {'find'} {'content'} {'challenge'} {'the'} {'community'} {'by'}
Columns 41 through 53
{'contributing'} {'problems'} {'comment'} {'on'} {'any'} {'problem'} {'or'} {'solution'} {'like'} {'a'} {'problem'} {'or'} {'a'}
Columns 54 through 58
{'solution'} {'earn'} {'badges'} {'play'} {'now'}
e =
1×44 cell array
Columns 1 through 13
{'a'} {'and'} {'any'} {'badges'} {'by'} {'can'} {'central'} {'challenge'} {'code'} {'cody'} {'comment'} {'community'} {'content'}
Columns 14 through 26
{'contributing'} {'directives'} {'earn'} {'expands'} {'find'} {'game'} {'is'} {'knowledge'} {'like'} {'matlab'} {'now'} {'of'} {'on'}
Columns 27 through 39
{'or'} {'play'} {'players'} {'problem'} {'problems'} {'related'} {'search'} {'solution'} {'solutions'} {'solve'} {'that'} {'the'} {'to'}
Columns 40 through 44
{'use'} {'what'} {'with'} {'you'} {'your'}
|
Find the peak 3n+1 sequence value
1108 Solvers
Renaming a field in a structure array
731 Solvers
Find state names that start with the letter N
598 Solvers
Remove white space from the string
168 Solvers
232 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!