Given a 2D array of ones and zeros, generate an equivalent sized checkerboard array of ones and twos. The checkerboard pattern starts with 2:

[2,1,2,1,2;
1,2,1,2,1;
2,1,2,1,2];

Then set this checkerboard array to zero wherever the original was zero.

Solution Stats

74 Solutions

30 Solvers

Last Solution submitted on Jan 16, 2026

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...

Problem Recent Solvers30

Suggested Problems

Problem Tags

Community Treasure Hunt

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

Start Hunting!