Cody

# Problem 45171. Squares in Squares - Concentric Squares

Solution 1975562

Submitted on 14 Oct 2019 by William
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 = 7; S_correct = ... [1 1 1 1 1 1 1; 1 0 0 0 0 0 1; 1 0 1 1 1 0 1; 1 0 1 0 1 0 1; 1 0 1 1 1 0 1; 1 0 0 0 0 0 1; 1 1 1 1 1 1 1]; Sn_correct = 2; [S,Sn] = squaresinsquares(n); assert(isequal(S,S_correct)); assert(isequal(Sn,Sn_correct));

2   Pass
n = 2; S_correct = [1 1; 1 1]; Sn_correct = 1; [S,Sn] = squaresinsquares(n); assert(isequal(S,S_correct)); assert(isequal(Sn,Sn_correct));

3   Pass
n = 1; S_correct = 1; Sn_correct = 1; [S,Sn] = squaresinsquares(n); assert(isequal(S,S_correct)); assert(isequal(Sn,Sn_correct));

4   Pass
n = 10; Sn_correct = 3; [~,Sn] = squaresinsquares(n); assert(isequal(Sn,Sn_correct));

5   Pass
n = 6; S_correct = ... [1 1 1 1 1 1; 1 0 0 0 0 1; 1 0 1 1 0 1; 1 0 1 1 0 1; 1 0 0 0 0 1; 1 1 1 1 1 1]; Sn_correct = 2; [S,Sn] = squaresinsquares(n); assert(isequal(S,S_correct)); assert(isequal(Sn,Sn_correct));