Cody

# Problem 753. Solitaire Cipher

Solution 1029144

Submitted on 24 Oct 2016 by TallBrian
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:28; n = 10; out = [3 22 9 4 23 7 25 16 14 14]; assert(isequal(solitaire(deck, n),out))

ans = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 out = 3 END ans = 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 1 out = 3 22 END ans = 25 27 1 28 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 26 out = 3 22 9 END ans = 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 26 27 2 3 28 25 4 1 out = 3 22 9 4 END ans = 3 25 4 28 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 26 1 27 2 out = 3 22 9 4 23 END ans = 12 13 14 15 16 17 18 19 20 21 22 23 24 26 1 2 27 3 25 4 5 28 7 8 9 10 11 6 out = 3 22 9 4 23 7 END ans = 6 27 25 4 5 7 8 28 12 13 14 15 16 17 18 19 20 21 22 23 24 26 1 2 9 10 11 3 out = 3 22 9 4 23 7 25 END ans = 28 6 14 15 16 17 18 19 20 21 22 23 24 26 1 2 9 10 11 3 27 4 5 7 8 12 13 25 out = 3 22 9 4 23 7 25 16 END ans = 22 23 24 26 1 2 9 10 11 3 4 27 6 5 7 8 12 13 25 28 15 16 17 18 19 20 21 14 out = 3 22 9 4 23 7 25 16 14 END ans = 27 5 7 8 12 13 25 15 16 28 22 23 24 26 1 2 9 10 11 3 4 17 18 19 20 21 14 6 out = 3 22 9 4 23 7 25 16 14 14 END

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

ans = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 out = 3 END ans = 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 1 out = 3 22 END ans = 25 27 1 28 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 26 out = 3 22 9 END ans = 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 26 27 2 3 28 25 4 1 out = 3 22 9 4 END ans = 3 25 4 28 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 26 1 27 2 out = 3 22 9 4 23 END ans = 12 13 14 15 16 17 18 19 20 21 22 23 24 26 1 2 27 3 25 4 5 28 7 8 9 10 11 6 out = 3 22 9 4 23 7 END ans = 6 27 25 4 5 7 8 28 12 13 14 15 16 17 18 19 20 21 22 23 24 26 1 2 9 10 11 3 out = 3 22 9 4 23 7 25 END ans = 28 6 14 15 16 17 18 19 20 21 22 23 24 26 1 2 9 10 11 3 27 4 5 7 8 12 13 25 out = 3 22 9 4 23 7 25 16 END ans = 22 23 24 26 1 2 9 10 11 3 4 27 6 5 7 8 12 13 25 28 15 16 17 18 19 20 21 14 out = 3 22 9 4 23 7 25 16 14 END