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))
'one two three' 'two one four zero'
'four' 'one' 'three' 'two' 'zero'
[1×3 double] [1×4 double]
|
2 | Pass |
sl = {'one two three'};
wtc = {'one','three','two'};
silc = {[1 3 2]};
[wt,sil] = word_index(sl);
assert(isequal(wt,wtc))
'one two three'
'one' 'three' 'two'
[1×3 double]
|
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))
'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'
Columns 1 through 16
'and' 'at' 'beef' 'computer' 'had' 'home' 'little' 'market' 'one' 'piggy' 'roast' 'science' 'stayed' 'studied' 'this' 'to'
Columns 17 through 18
'university' 'went'
[1×6 double] [1×6 double] [1×6 double] [1×9 double]
|
246 Solvers
Return the first and last character of a string
3449 Solvers
Get the elements of diagonal and antidiagonal for any m-by-n matrix
268 Solvers
Remove element(s) from cell array
373 Solvers
1173 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!