Given n (always odd), return output a that has concentric rings of the 1s and 0s around the center point. Examples:

 Input  n = 3
 Output a is [ 1 1 1 
               1 0 1
               1 1 1 ]
 Input  n = 5
 Output a is [    1     1     1     1     1
                  1     0     0     0     1
                  1     0     1     0     1
                  1     0     0     0     1
                  1     1     1     1     1]

Solution Stats

356 Solutions

156 Solvers

Last Solution submitted on Jan 05, 2026

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...

Problem Recent Solvers156

Suggested Problems

More from this Author16

Problem Tags

Community Treasure Hunt

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

Start Hunting!