Cody

Problem 45405. ZigZag - 05

Solution 2184148

Submitted on 31 Mar 2020 by Mehmed Saad
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=[13 10 7 4 9 5 16 11 6 1]; assert(isequal(alpha_pattern(x),y))

ans = 13 10 7 4 9 5 16 11 6 1

2   Pass
x = pascal(7); y=[1 6 15 20 15 6 1 1 1 1 1 1 1 2 6 20 70 252 924]; assert(isequal(alpha_pattern(x),y))

ans = 1 6 15 20 15 6 1 1 1 1 1 1 1 2 6 20 70 252 924

3   Pass
x = pascal(7); x([1,2],:)=[] y=[28 56 70 56 28 1 1 1 1 4 15 56 210]; assert(isequal(alpha_pattern(x),y))

x = 1 3 6 10 15 21 28 1 4 10 20 35 56 84 1 5 15 35 70 126 210 1 6 21 56 126 252 462 1 7 28 84 210 462 924 ans = 28 56 70 56 28 1 1 1 1 4 15 56 210

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

ans = 0 0 1 0 0 0 0 0 1 1 1 1 1

Suggested Problems

More from this Author149

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!