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
Problem Comments
1 Comment
Solution Comments
Show comments
Loading...
Problem Recent Solvers30
Suggested Problems
-
Remove the two elements next to NaN value
703 Solvers
-
Given a window, how many subsets of a vector sum positive
870 Solvers
-
559 Solvers
-
Back to Basics - Find no. of elements in a matrix?
327 Solvers
-
Given a square and a circle, please decide whether the square covers more area.
1718 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
You should add a test case where the last row and/or last column of x contains only zeroes.