Cody

# Problem 3053. stem and leaf plot

Solution 1591639

Submitted on 25 Jul 2018
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   Fail
x = {'12','15','14','23','24','26','28','33','38','39'} y_correct = {'1245','23468','3389'} assert(isequal(stem_leaf(x),y_correct))

x = 1×10 cell array {'12'} {'15'} {'14'} {'23'} {'24'} {'26'} {'28'} {'33'} {'38'} {'39'} y_correct = 1×3 cell array {'1245'} {'23468'} {'3389'}

Error using sort Only one input argument is supported for cell arrays. Error in stem_leaf (line 2) y = sort(x,'descend'); Error in Test1 (line 3) assert(isequal(stem_leaf(x),y_correct))

2   Fail
x = {'00','11','02','33','32','31','34','14'} y_correct = {'002','114','31234'} assert(isequal(stem_leaf(x),y_correct))

x = 1×8 cell array {'00'} {'11'} {'02'} {'33'} {'32'} {'31'} {'34'} {'14'} y_correct = 1×3 cell array {'002'} {'114'} {'31234'}

Error using sort Only one input argument is supported for cell arrays. Error in stem_leaf (line 2) y = sort(x,'descend'); Error in Test2 (line 3) assert(isequal(stem_leaf(x),y_correct))

3   Fail
x = {'04','13','12','11','14','16','17','18','13','12','11','14','16','17','18'} y_correct = {'04','111223344667788'} assert(isequal(stem_leaf(x),y_correct))

x = 1×15 cell array {'04'} {'13'} {'12'} {'11'} {'14'} {'16'} {'17'} {'18'} {'13'} {'12'} {'11'} {'14'} {'16'} {'17'} {'18'} y_correct = 1×2 cell array {'04'} {'111223344667788'}

Error using sort Only one input argument is supported for cell arrays. Error in stem_leaf (line 2) y = sort(x,'descend'); Error in Test3 (line 3) assert(isequal(stem_leaf(x),y_correct))

4   Fail
x = {'23','123','125','105','24','106'} y_correct = {'234','1056','1235'} assert(isequal(stem_leaf(x),y_correct))

x = 1×6 cell array {'23'} {'123'} {'125'} {'105'} {'24'} {'106'} y_correct = 1×3 cell array {'234'} {'1056'} {'1235'}

Error using sort Only one input argument is supported for cell arrays. Error in stem_leaf (line 2) y = sort(x,'descend'); Error in Test4 (line 3) assert(isequal(stem_leaf(x),y_correct))

5   Fail
x = {'01','12','33','45','54','67'}; y_correct = x; assert(isequal(stem_leaf(x),y_correct))

Error using sort Only one input argument is supported for cell arrays. Error in stem_leaf (line 2) y = sort(x,'descend'); Error in Test5 (line 3) assert(isequal(stem_leaf(x),y_correct))