Cody

Solution 2184582

Submitted on 31 Mar 2020 by William
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 = magic(4); y=[16 2 3 13 8 10 11 5 9 7 6 12 1 15 14 4]; assert(isequal(zigzag_pattern(x),y))

2   Pass
x = magic(4); x(4,:)=[]; y=[16 2 3 13 8 10 11 5 9 7 6 12 ]; assert(isequal(zigzag_pattern(x),y))

3   Pass
x = magic(4); x(:,[3,4])=[] y=[16 2 11 5 9 7 14 4]; assert(isequal(zigzag_pattern(x),y))

x = 16 2 5 11 9 7 4 14

4   Pass
x = eye(7); y=[1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1] assert(isequal(zigzag_pattern(x),y))

y = Columns 1 through 30 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 Columns 31 through 49 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1

5   Pass
%x = hilb(3); %y=[1.0000 0.5000 0.3333 0.2500 0.3333 0.5000 0.3333 0.2500 0.2000] %assert(isequal(zigzag_pattern(x),y))

6   Pass
x=pascal(5); y=[1 1 1 1 1 5 4 3 2 1 1 3 6 10 15 35 20 10 4 1 1 5 15 35 70] assert(isequal(zigzag_pattern(x),y))

y = 1 1 1 1 1 5 4 3 2 1 1 3 6 10 15 35 20 10 4 1 1 5 15 35 70

Suggested Problems

More from this Author145