Cody

# Problem 1755. Fix the last element of a cell array

Solution 563347

Submitted on 22 Jan 2015 by Michael Cappello
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
%% A = {'MATLAB','HURRAY','SPARKLY','KITTENS','FUN'}; B = 'KITTENS'; C = {'MATLAB','HURRAY','SPARKLY','FUN','KITTENS'}; assert(isequal(puzzler(A,B),C))

n = 5 idx = 4 i = 1 2 3 4 5 i = 1 2 3 5 C = 'MATLAB' 'HURRAY' 'SPARKLY' 'FUN' 'KITTENS'

2   Pass
%% A = {'HELP!','I''VE','FALLEN','ON THE','CAPS LOCK','KEY'}; B = 'stop shouting'; C = {'HELP!','I''VE','FALLEN','ON THE','CAPS LOCK','KEY'}; assert(isequal(puzzler(A,B),C))

n = 6 idx = Empty matrix: 1-by-0

3   Pass
%% A = {'When','in the','human events','course','of'}; B = 'human events'; C = {'When','in the','course','of','human events'}; assert(isequal(puzzler(A,B),C))

n = 5 idx = 3 i = 1 2 3 4 5 i = 1 2 4 5 C = 'When' 'in the' 'course' 'of' 'human events'

4   Pass
%% A = {'Soulwise','these','times','are','trying'}; B = 'times'; C = {'Soulwise','these','are','trying','times'}; assert(isequal(puzzler(A,B),C))

n = 5 idx = 3 i = 1 2 3 4 5 i = 1 2 4 5 C = 'Soulwise' 'these' 'are' 'trying' 'times'