Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
sl = {'one two three','two one four zero'};
wtc = {'four','one','three','two','zero'};
silc = {[2 4 3],[4 2 1 5]};
[wt,sil] = word_index(sl);
assert(isequal(wt,wtc))
b =
1×7 cell array
{'one'} {'two'} {'three'} {'two'} {'one'} {'four'} {'zero'}
c =
1×5 cell array
{'four'} {'one'} {'three'} {'two'} {'zero'}
len =
2
a =
1×3 cell array
{'one'} {'two'} {'three'}
len2 =
3
d =
2
d =
2 4
d =
2 4 3
a =
1×4 cell array
{'two'} {'one'} {'four'} {'zero'}
len2 =
4
d =
4 4 3
d =
4 2 3
d =
4 2 1
d =
4 2 1 5
|
2 | Pass |
sl = {'one two three'};
wtc = {'one','three','two'};
silc = {[1 3 2]};
[wt,sil] = word_index(sl);
assert(isequal(wt,wtc))
b =
1×3 cell array
{'one'} {'two'} {'three'}
c =
1×3 cell array
{'one'} {'three'} {'two'}
len =
1
a =
1×3 cell array
{'one'} {'two'} {'three'}
len2 =
3
d =
1
d =
1 3
d =
1 3 2
|
3 | Pass |
sl = {'this little piggy went to market', ...
'and this little piggy stayed home', ...
'this little piggy had roast beef', ...
'and this one studied computer science at piggy university'};
wtc = { ...
'and','at','beef','computer','had','home', ...
'little','market','one','piggy','roast','science', ...
'stayed','studied','this','to','university','went'};
silc = { ...
[15 7 10 18 16 8], ...
[1 15 7 10 13 6], ...
[15 7 10 5 11 3], ...
[ 1 15 9 14 4 12 2 10 17]};
[wt,sil] = word_index(sl);
assert(isequal(wt,wtc))
b =
1×27 cell array
Columns 1 through 14
{'this'} {'little'} {'piggy'} {'went'} {'to'} {'market'} {'this'} {'little'} {'piggy'} {'had'} {'roast'} {'beef'} {'and'} {'this'}
Columns 15 through 27
{'little'} {'piggy'} {'stayed'} {'home'} {'and'} {'this'} {'one'} {'studied'} {'computer'} {'science'} {'at'} {'piggy'} {'university'}
c =
1×18 cell array
Columns 1 through 14
{'and'} {'at'} {'beef'} {'computer'} {'had'} {'home'} {'little'} {'market'} {'one'} {'piggy'} {'roast'} {'science'} {'stayed'} {'studied'}
Columns 15 through 18
{'this'} {'to'} {'university'} {'went'}
len =
2
a =
1×6 cell array
{'this'} {'little'} {'piggy'} {'went'} {'to'} {'market'}
len2 =
6
d =
15
d =
15 7
d =
15 7 10
d =
15 7 10 18
d =
15 7 10 18 16
d =
15 7 10 18 16 8
a =
1×6 cell array
{'this'} {'little'} {'piggy'} {'had'} {'roast'} {'beef'}
len2 =
6
d =
15 7 10 18 16 8
d =
15 7 10 18 16 8
d =
15 7 10 18 16 8
d =
15 7 10 5 16 8
d =
15 7 10 5 11 8
d =
15 7 10 5 11 3
|
What is the next step in Conway's Life?
640 Solvers
Calculate the area of a triangle between three points
874 Solvers
Who has power to do everything in this world?
318 Solvers
412 Solvers
255 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!