Cody

Solution 1694191

Submitted on 17 Dec 2018 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
n = 5; a = no_recs(n); d = size(a); assert(isequal(d,[n n])); % Only the numbers 1:4 tf = isempty(setdiff(a,[1 2 3 4])); assert(tf) % No rectangles tf = ~any(arrayfun(@(n)any(sum((a==n)'*double(a==n)>1)>1),1:4)); assert(tf)

rowstart = 11 colstart = 5

2   Pass
n = 8; a = no_recs(n); d = size(a); assert(isequal(d,[n n])); % Only the numbers 1:4 tf = isempty(setdiff(a,[1 2 3 4])); assert(tf) % No rectangles tf = ~any(arrayfun(@(n)any(sum((a==n)'*double(a==n)>1)>1),1:4)); assert(tf)

rowstart = 8 colstart = 6

3   Pass
n = 12; a = no_recs(n); d = size(a); assert(isequal(d,[n n])); % Only the numbers 1:4 tf = isempty(setdiff(a,[1 2 3 4])); assert(tf) % No rectangles tf = ~any(arrayfun(@(n)any(sum((a==n)'*double(a==n)>1)>1),1:4)); assert(tf)

rowstart = 2 colstart = 2