Cody

Solution 2658209

Submitted on 6 Jul 2020 at 11:57
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   Fail
s = [5 0 0 0 0 6 0 0 0 9 0 0 0 0 0 2 7 0 0 0 8 0 0 7 4 0 0 0 2 0 3 9 0 0 0 0 1 0 0 0 0 0 0 0 8 0 0 0 0 4 2 0 6 0 0 0 7 4 0 0 8 0 0 0 5 1 0 0 0 0 0 4 0 0 0 6 0 0 0 0 9]; n = nnz(s==0); for t = 1 : n tt = mat2cell(s,[3,3,3],[3,3,3]); [i,j,d] = your_fcn_name(s); s(i,j) = d; rc = histcounts(setdiff(s(i,:),0)); cc = histcounts(setdiff(s(:,j),0)); gr = ceil(i/3); gc = ceil(j/3); gcc = histcounts(setdiff(tt{gr,gc},0)); assert(max(rc)==1&max(cc)==1&max(gcc)==1); end M = cellfun(@(x)x(:)',mat2cell(s,[3,3,3],[3,3,3]),'UniformOutput',false); p = [s;s';cell2mat(M(:))]; assert(isequal(unique(sort(p,2), 'rows'),1:9));

Error using your_fcn_name Too many output arguments. Error in Test1 (line 14) [i,j,d] = your_fcn_name(s);

2   Fail
s = [9 0 0 8 0 7 0 0 0 0 0 0 0 0 0 7 3 5 3 0 7 0 1 0 0 0 0 0 7 0 3 0 8 0 6 0 5 0 0 0 0 0 0 0 7 0 4 0 7 0 2 0 1 0 0 0 0 0 7 0 8 0 3 7 6 4 0 0 0 0 0 0 0 0 0 1 0 5 0 0 9]; n = nnz(s==0); for t = 1 : n tt = mat2cell(s,[3,3,3],[3,3,3]); [i,j,d] = your_fcn_name(s); s(i,j) = d; rc = histcounts(setdiff(s(i,:),0)); cc = histcounts(setdiff(s(:,j),0)); gr = ceil(i/3); gc = ceil(j/3); gcc = histcounts(setdiff(tt{gr,gc},0)); assert(max(rc)==1&max(cc)==1&max(gcc)==1); end M = cellfun(@(x)x(:)',mat2cell(s,[3,3,3],[3,3,3]),'UniformOutput',false); p = [s;s';cell2mat(M(:))]; assert(isequal(unique(sort(p,2), 'rows'),1:9));

Error using your_fcn_name Too many output arguments. Error in Test2 (line 14) [i,j,d] = your_fcn_name(s);