Cody

Solution 2173564

Submitted on 24 Mar 2020 by Nikolaos Nikolaou
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))

m = -1 0 1 t = 4 y = 4 t = 2 3 t = 3 2 y = 4 3 2 t = 1 y = 4 3 2 1 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))

m = -2 -1 0 1 2 t = 9 y = 9 t = 6 8 t = 8 6 y = 9 8 6 t = 3 5 7 y = 9 8 6 3 5 7 t = 2 4 t = 4 2 y = 9 8 6 3 5 7 4 2 t = 1 y = 9 8 6 3 5 7 4 2 1 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))

m = -3 -2 -1 0 1 2 3 t = 1 y = 1 t = 12 15 t = 15 12 y = 1 15 12 t = 8 6 14 y = 1 15 12 8 6 14 t = 13 10 7 4 t = 4 7 10 13 y = 1 15 12 8 6 14 4 7 10 13 t = 3 11 9 y = 1 15 12 8 6 14 4 7 10 13 3 11 9 t = 2 5 t = 5 2 y = 1 15 12 8 6 14 4 7 10 13 3 11 9 5 2 t = 16 y = 1 15 12 8 6 14 4 7 10 13 3 11 9 5 2 16 y = 16 2 5 9 11 3 13 10 7 4 14 6 8 12 15 1