Cody

# Problem 45171. Squares in Squares - Concentric Squares

Solution 3130236

Submitted on 9 Oct 2020 by Mehmet OZC
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));

### Community Treasure Hunt

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

Start Hunting!