Cody

# Problem 45171. Squares in Squares - Concentric Squares

Solution 2090095

Submitted on 12 Jan 2020 by Asif Newaz
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));

y1 = 2

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));

y1 = 1

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

y1 = 1

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

y1 = 3

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));

y1 = 2

### Community Treasure Hunt

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

Start Hunting!