Cody

Solution 2109039

Submitted on 28 Jan 2020 by T-tops
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
filetext = fileread('your_fcn_name.m') assert(~isempty(strfind(filetext, 'gallery'))) assert( isempty(strfind(filetext, '% gallery')))

filetext = 'function y = your_fcn_name(n) y = gallery('binomial',n) y(y==0) = 1 y = y - diag(diag(y,floor(size(y,1)/2)),floor(size(y,1)/2)); y = flip(y); y = y - diag(diag(y,floor(size(y,1)/2)),floor(size(y,1)/2)); y = flip(y,2); y = y - diag(diag(y,floor(size(y,1)/2)),floor(size(y,1)/2)); y = flip(y); y = y - diag(diag(y,floor(size(y,1)/2)),floor(size(y,1)/2)); y = ~logical(y); end %This code written by profile_id 8261026 '

2   Pass
n = 5; expected = [0 0 1 0 0 0 1 0 1 0 1 0 0 0 1 0 1 0 1 0 0 0 1 0 0]; y_correct = logical(expected) assert(isequal(your_fcn_name(n),y_correct))

y_correct = 5×5 logical array 0 0 1 0 0 0 1 0 1 0 1 0 0 0 1 0 1 0 1 0 0 0 1 0 0 y = 1 4 6 4 1 1 2 0 -2 -1 1 0 -2 0 1 1 -2 0 2 -1 1 -4 6 -4 1 y = 1 4 6 4 1 1 2 1 -2 -1 1 1 -2 1 1 1 -2 1 2 -1 1 -4 6 -4 1

3   Pass
n = 9; expected = [ 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 1 0 0 0 0] y_correct = logical(expected) assert(isequal(your_fcn_name(n),y_correct))

expected = 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 1 0 0 0 0 y_correct = 9×9 logical array 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 1 0 0 0 0 y = 1 8 28 56 70 56 28 8 1 1 6 14 14 0 -14 -14 -6 -1 1 4 4 -4 -10 -4 4 4 1 1 2 -2 -6 0 6 2 -2 -1 1 0 -4 0 6 0 -4 0 1 1 -2 -2 6 0 -6 2 2 -1 1 -4 4 4 -10 4 4 -4 1 1 -6 14 -14 0 14 -14 6 -1 1 -8 28 -56 70 -56 28 -8 1 y = 1 8 28 56 70 56 28 8 1 1 6 14 14 1 -14 -14 -6 -1 1 4 4 -4 -10 -4 4 4 1 1 2 -2 -6 1 6 2 -2 -1 1 1 -4 1 6 1 -4 1 1 1 -2 -2 6 1 -6 2 2 -1 1 -4 4 4 -10 4 4 -4 1 1 -6 14 -14 1 14 -14 6 -1 1 -8 28 -56 70 -56 28 -8 1