Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
s = 'Easy';
b = ones(1,4);
y_correct = {'E','a','s','y'};
assert(isequal(break_string(s,b),y_correct))
d =
1
y =
1×1 cell array
{'E'}
c =
2
d =
2
y =
1×2 cell array
{'E'} {'a'}
c =
3
d =
3
y =
1×3 cell array
{'E'} {'a'} {'s'}
c =
4
d =
4
y =
1×4 cell array
{'E'} {'a'} {'s'} {'y'}
c =
5
|
2 | Pass |
s = 'I seem to be having tremendous difficulty with my lifestyle';
b = [4 1 5 22];
y_correct = {'I se','e','m to ','be having tremendous d'};
assert(isequal(break_string(s,b),y_correct))
d =
4
y =
1×1 cell array
{'I se'}
c =
5
d =
5
y =
1×2 cell array
{'I se'} {'e'}
c =
6
d =
10
y =
1×3 cell array
{'I se'} {'e'} {'m to '}
c =
11
d =
32
y =
1×4 cell array
{'I se'} {'e'} {'m to '} {'be having tremendous d'}
c =
33
|
3 | Pass |
s = 'The answer is 42';
b = [4 7 3];
y_correct = {'The ','answer ','is '};
assert(isequal(break_string(s,b),y_correct))
d =
4
y =
1×1 cell array
{'The '}
c =
5
d =
11
y =
1×2 cell array
{'The '} {'answer '}
c =
12
d =
14
y =
1×3 cell array
{'The '} {'answer '} {'is '}
c =
15
|
4 | Pass |
s = 'Did I do that?';
b = [2 3 3];
y_correct = {'Di','d I',' do'};
assert(isequal(break_string(s,b),y_correct))
d =
2
y =
1×1 cell array
{'Di'}
c =
3
d =
5
y =
1×2 cell array
{'Di'} {'d I'}
c =
6
d =
8
y =
1×3 cell array
{'Di'} {'d I'} {' do'}
c =
9
|
5 | Pass |
s = 'Yes no when?';
b = [2 6 3];
y_correct = {'Ye','s no w','hen'};
assert(isequal(break_string(s,b),y_correct))
d =
2
y =
1×1 cell array
{'Ye'}
c =
3
d =
8
y =
1×2 cell array
{'Ye'} {'s no w'}
c =
9
d =
11
y =
1×3 cell array
{'Ye'} {'s no w'} {'hen'}
c =
12
|
6 | Pass |
s = 'Hello there';
b = [3 4 4];
y_correct = {'Hel','lo t','here'};
assert(isequal(break_string(s,b),y_correct))
d =
3
y =
1×1 cell array
{'Hel'}
c =
4
d =
7
y =
1×2 cell array
{'Hel'} {'lo t'}
c =
8
d =
11
y =
1×3 cell array
{'Hel'} {'lo t'} {'here'}
c =
12
|
7 | Pass |
s = 'One is not enough!';
b = [3 1 1];
y_correct = {'One',' ','i'};
assert(isequal(break_string(s,b),y_correct))
d =
3
y =
1×1 cell array
{'One'}
c =
4
d =
4
y =
1×2 cell array
{'One'} {' '}
c =
5
d =
5
y =
1×3 cell array
{'One'} {' '} {'i'}
c =
6
|
Replace NaNs with the number that appears to its left in the row.
2018 Solvers
Project Euler: Problem 2, Sum of even Fibonacci
835 Solvers
Convert a numerical matrix into a cell array of strings
455 Solvers
3065 Solvers
169 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!