Cody

# Problem 2479. Mongean Shuffle

Solution 1496721

Submitted on 18 Apr 2018 by Robert Hamilton
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
% trivial x = 1; y_correct = 1; assert(isequal(mshuffle(x),y_correct))

y = 1

2   Pass
x = 1:5; y_correct = [4 2 1 3 5]; assert(isequal(mshuffle(x),y_correct))

y = 1 y = 2 1 3 y = 4 2 1 3 5

3   Pass
a = magic(5); a=a(:)'; y_correct = [3 16 2 20 8 19 7 18 6 24 10 23 17 4 11 5 12 1 13 25 14 21 15 22 9]; assert(isequal(mshuffle(a),y_correct));

y = 17 y = 23 17 4 y = 10 23 17 4 11 y = 24 10 23 17 4 11 5 y = 6 24 10 23 17 4 11 5 12 y = 18 6 24 10 23 17 4 11 5 12 1 y = 7 18 6 24 10 23 17 4 11 5 12 1 13 y = 19 7 18 6 24 10 23 17 4 11 5 12 1 13 25 y = 8 19 7 18 6 24 10 23 17 4 11 5 12 1 13 25 14 y = 20 8 19 7 18 6 24 10 23 17 4 11 5 12 1 13 25 14 21 y = 2 20 8 19 7 18 6 24 10 23 17 4 11 5 12 1 13 25 14 21 15 y = 16 2 20 8 19 7 18 6 24 10 23 17 4 11 5 12 1 13 25 14 21 15 22 y = 3 16 2 20 8 19 7 18 6 24 10 23 17 4 11 5 12 1 13 25 14 21 15 22 9

4   Pass
x = 7:-1:1; y_correct = [2 4 6 7 5 3 1]; assert(isequal(mshuffle(x),y_correct))

y = 7 y = 6 7 5 y = 4 6 7 5 3 y = 2 4 6 7 5 3 1