Cody

Solution 357843

Submitted on 22 Nov 2013 by James
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 1; 5 6 7; 2 3 6]; output = [1 1 1; 1 1 1; 1 1 1] assert(isequal(neighbors(x),output))
output = 1 1 1 1 1 1 1 1 1 sx1 = 3 sx2 = 3 a = Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf a = Inf Inf Inf Inf Inf Inf 1 2 1 Inf Inf 5 6 7 Inf Inf 2 3 6 Inf Inf Inf Inf Inf Inf
2   Pass
%% x = [8 8 8; 4 4 4; 1 9 7] output = [1 1 1; 1 1 1; 0 0 0] assert(isequal(neighbors(x),output))
x = 8 8 8 4 4 4 1 9 7 output = 1 1 1 1 1 1 0 0 0 sx1 = 3 sx2 = 3 a = Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf a = Inf Inf Inf Inf Inf Inf 8 8 8 Inf Inf 4 4 4 Inf Inf 1 9 7 Inf Inf Inf Inf Inf Inf
3   Pass
%% x = [1 8 5; 4 10 22; 1 66 7] output = [0 0 0; 0 0 0; 0 0 0] assert(isequal(neighbors(x),output))
x = 1 8 5 4 10 22 1 66 7 output = 0 0 0 0 0 0 0 0 0 sx1 = 3 sx2 = 3 a = Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf a = Inf Inf Inf Inf Inf Inf 1 8 5 Inf Inf 4 10 22 Inf Inf 1 66 7 Inf Inf Inf Inf Inf Inf