Cody

Solution 1936707

Submitted on 15 Sep 2019 by Sivakumar Selvam
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
s = 'Easy'; b = ones(1,4); y_correct = {'E','a','s','y'}; assert(isequal(break_string(s,b),y_correct))

start = 1 final = 0 final = 1 y = "E" start = 2 final = 2 y = 1×2 string array "E" "a" start = 3 final = 3 y = 1×3 string array "E" "a" "s" start = 4 final = 4 y = 1×4 string array "E" "a" "s" "y" start = 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))

start = 1 final = 0 final = 4 y = "I se" start = 5 final = 5 y = 1×2 string array "I se" "e" start = 6 final = 10 y = 1×3 string array "I se" "e" "m to " start = 11 final = 32 y = 1×4 string array "I se" "e" "m to " "be having tremendous d" start = 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))

start = 1 final = 0 final = 4 y = "The " start = 5 final = 11 y = 1×2 string array "The " "answer " start = 12 final = 14 y = 1×3 string array "The " "answer " "is " start = 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))

start = 1 final = 0 final = 2 y = "Di" start = 3 final = 5 y = 1×2 string array "Di" "d I" start = 6 final = 8 y = 1×3 string array "Di" "d I" " do" start = 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))

start = 1 final = 0 final = 2 y = "Ye" start = 3 final = 8 y = 1×2 string array "Ye" "s no w" start = 9 final = 11 y = 1×3 string array "Ye" "s no w" "hen" start = 12

6   Pass
s = 'Hello there'; b = [3 4 4]; y_correct = {'Hel','lo t','here'}; assert(isequal(break_string(s,b),y_correct))

start = 1 final = 0 final = 3 y = "Hel" start = 4 final = 7 y = 1×2 string array "Hel" "lo t" start = 8 final = 11 y = 1×3 string array "Hel" "lo t" "here" start = 12

7   Pass
s = 'One is not enough!'; b = [3 1 1]; y_correct = {'One',' ','i'}; assert(isequal(break_string(s,b),y_correct))

start = 1 final = 0 final = 3 y = "One" start = 4 final = 4 y = 1×2 string array "One" " " start = 5 final = 5 y = 1×3 string array "One" " " "i" start = 6

Suggested Problems

More from this Author1