Cody

Solution 433393

Submitted on 17 Apr 2014 by Joel
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, sign in.

Test Suite

Test Status Code Input and Output
1   Pass
%% n = 5; a = [1 0 1 0 1; 0 1 0 1 0; 1 0 1 0 1; 0 1 0 1 0; 1 0 1 0 1]; assert(isequal(a,checkerboard(n)))

a = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ii = 1 k = 1 t = 1 a = 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 k = 2 a = 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 k = 3 a = 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 k = 4 a = 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 k = 5 a = 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 k = 6 a = 1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 k = 7 a = 1 0 1 0 0 0 1 0 0 0 1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 k = 8 a = 1 0 1 0 0 0 1 0 0 0 1 0 1 0 0 0 1 0 0 0 1 0 1 0 0 k = 9 a = 1 0 1 0 0 0 1 0 1 0 1 0 1 0 0 0 1 0 0 0 1 0 1 0 0 k = 10 a = 1 0 1 0 0 0 1 0 1 0 1 0 1 0 0 0 1 0 1 0 1 0 1 0 0 k = 11 a = 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 1 0 1 0 1 0 1 0 0 k = 12 a = 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 k = 13 columns = 1 t = 2 columns = 1 2 t = 3 columns = 1 2 3 t = 4 columns = 1 2 3 4 t = 5 columns = 1 2 3 4 5 t = 6 a = 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

2   Pass
%% n = 4; a = [1 0 1 0; 0 1 0 1; 1 0 1 0; 0 1 0 1]; assert(isequal(a,checkerboard(n)))

a = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ii = 1 k = 1 t = 1 a = 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 k = 2 a = 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 k = 3 a = 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 k = 4 a = 1 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 k = 5 a = 1 1 1 0 0 0 0 0 1 1 0 0 0 0 0 0 k = 6 a = 1 1 1 0 0 0 0 0 1 1 1 0 0 0 0 0 k = 7 a = 1 1 1 1 0 0 0 0 1 1 1 0 0 0 0 0 k = 8 a = 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 k = 9 columns = 1 t = 2 columns = 1 2 t = 3 columns = 1 2 3 t = 4 columns = 1 2 3 4 t = 5 ii = 2 c = 2 4 d = 1 3 a = 1 1 1 1 0 1 0 0 1 1 1 1 0 1 0 0 a = 1 0 1 1 0 1 0 0 1 0 1 1 0 1 0 0 ii = 3 ii = 4 c = 2 4 d = 1 3 a = 1 0 1 1 0 1 0 1 1 0 1 1 0 1 0 1 a = 1 0 1 0 0 1 0 1 1 0 1 0 0 1 0 1 ii = 5