Cody

Solution 1728858

Submitted on 17 Feb 2019 by Alfonso Nieto-Castanon
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
a = [1 2 3;4 5 6;7 8 9]; y_correct = [1 2 4 7 5 3 6 8 9]; assert(isequal(zigzag(a),y_correct))

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

3   Pass
a = [1 2; 3 4]; y_correct = 1:4; assert(isequal(zigzag(a),y_correct))

4   Pass
a = ones(5); y_correct = ones(1,25); assert(isequal(zigzag(a),y_correct))

5   Pass
a = eye(4); y_correct = [1 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1]; assert(isequal(zigzag(a),y_correct))