Cody

Problem 753. Solitaire Cipher

Solution 285790

Submitted on 19 Jul 2013 by Matthew Eicholtz
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
deck = [1 4 7 10 13 16 19 22 25 28 3 6 9 12 15 18 21 24 27 2 5 8 11 14 17 20 23 26]; n = 10; out = [8 26 1 4 7 23 8 8 4 24]; assert(isequal(solitaire(deck, n),out))

idx3 = 12 20 idx3 = 5 12 idx3 = 7 13 idx3 = 5 27 idx3 = 12 16 idx3 = 14 17 idx3 = 23 25 idx3 = 11 12 idx3 = 9 10 idx3 = 22 24

2   Pass
%% deck = 1:28; n = 10; out = [3 22 9 4 23 7 25 16 14 14]; assert(isequal(solitaire(deck, n),out))

idx3 = 2 28 idx3 = 26 28 idx3 = 3 6 idx3 = 23 27 idx3 = 6 28 idx3 = 18 24 idx3 = 3 10 idx3 = 3 22 idx3 = 13 22 idx3 = 2 12

3   Pass
%% deck = 1:28; n = 9; out = [3 22 9 4 23 7 25 16 14]; assert(isequal(solitaire(deck, n),out))

idx3 = 2 28 idx3 = 26 28 idx3 = 3 6 idx3 = 23 27 idx3 = 6 28 idx3 = 18 24 idx3 = 3 10 idx3 = 3 22 idx3 = 13 22