Cody

# Problem 2160. The 17x17 Problem

Solution 434015

Submitted on 20 Apr 2014 by J.R.! Menzinger
• Size: 19
• This is the leading solution.
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)

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)

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)

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!