Cody

Problem 1325. Special matrix

Solution 1279261

Submitted on 30 Sep 2017 by HH
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 = 3; y_correct = [1 1 0 1 0 1 0 1 1]; assert(isequal(your_fcn_name(x),y_correct))

ans = (2,1) 1 (1,2) 1 (3,2) 1 (2,3) 1

2   Pass
x = 4; y_correct = [ 1 1 0 0 1 0 1 0 0 1 0 1 0 0 1 1]; assert(isequal(your_fcn_name(x),y_correct))

ans = (2,1) 1 (1,2) 1 (3,2) 1 (2,3) 1 (4,3) 1 (3,4) 1

3   Pass
x = 5; y_correct = [ 1 1 0 0 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 0 0 1 1]; assert(isequal(your_fcn_name(x),y_correct))

ans = (2,1) 1 (1,2) 1 (3,2) 1 (2,3) 1 (4,3) 1 (3,4) 1 (5,4) 1 (4,5) 1

4   Pass
x = 6; y_correct = [ 1 1 0 0 0 0 1 0 1 0 0 0 0 1 0 1 0 0 0 0 1 0 1 0 0 0 0 1 0 1 0 0 0 0 1 1]; assert(isequal(your_fcn_name(x),y_correct))

ans = (2,1) 1 (1,2) 1 (3,2) 1 (2,3) 1 (4,3) 1 (3,4) 1 (5,4) 1 (4,5) 1 (6,5) 1 (5,6) 1

5   Pass
x = 18; y_correct = [ 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1]; assert(isequal(your_fcn_name(x),y_correct))

ans = (2,1) 1 (1,2) 1 (3,2) 1 (2,3) 1 (4,3) 1 (3,4) 1 (5,4) 1 (4,5) 1 (6,5) 1 (5,6) 1 (7,6) 1 (6,7) 1 (8,7) 1 (7,8) 1 (9,8) 1 (8,9) 1 (10,9) 1 (9,10) 1 (11,10) 1 (10,11) 1 (12,11) 1 (11,12) 1 (13,12) 1 (12,13) 1 (14,13) 1 (13,14) 1 (15,14) 1 (14,15) 1 (16,15) 1 (15,16) 1 (17,16) 1 (16,17) 1 (18,17) 1 (17,18) 1

Suggested Problems

More from this Author2

Community Treasure Hunt

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

Start Hunting!