Cody

Solution 1577736

Submitted on 7 Jul 2018 by Yuichi Tadokoro
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
x = [1 2; 3 4]; y_correct = [1 2 3 4]; assert(isequal(zigzag(x),y_correct))

a = 1 b = 1 a = 2 1 b = 1 2 a = 2 b = 2 y = 1 2 3 4

2   Pass
x = [ 1 2 3; 4 5 6; 7 8 9]; y_correct = [ 1 2 4 7 5 3 6 8 9]; assert(isequal(zigzag(x),y_correct))

a = 1 b = 1 a = 2 1 b = 1 2 a = 3 2 1 b = 1 2 3 a = 3 2 b = 2 3 a = 3 b = 3 y = 1 2 4 7 5 3 6 8 9

3   Pass
x = magic(4); y_correct = [16 2 5 9 11 3 13 10 7 4 14 6 8 12 15 1]; assert(isequal(zigzag(x),y_correct))

a = 1 b = 1 a = 2 1 b = 1 2 a = 3 2 1 b = 1 2 3 a = 4 3 2 1 b = 1 2 3 4 a = 4 3 2 b = 2 3 4 a = 4 3 b = 3 4 a = 4 b = 4 y = 16 2 5 9 11 3 13 10 7 4 14 6 8 12 15 1