Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 237902

Submitted on 30 Apr 2013 by G K

Correct

352Size
This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
%%
x = '';
y_correct = [2:28,1];
assert(isequal(solitaireKey(x),y_correct))

                    
2
Pass
 
%%
x = 'SECRET KEY';
y_correct = [26 25 7 8 2 13 6 16 27 4 5 19 23 21 14 15 9 3 20 11 12 28 17 18 10 1 24 22];
assert(isequal(solitaireKey(x),y_correct))

                    
3
Pass
 
%%
x = 'I don''t know the key to success, but the key to failure is trying to please everybody.';
y_correct = [16 10 28 4 26 25 8 27 19 24 7 1 9 21 22 23 17 11 14 15 12 13 20 5 2 3 18 6];
assert(isequal(solitaireKey(x),y_correct))