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 Solvers32
Suggested Problems
-
Find the longest sequence of 1's in a binary sequence.
6815 Solvers
-
Maximum running product for a string of numbers
2257 Solvers
-
Remove the polynomials that have positive real elements of their roots.
1743 Solvers
-
Back to basics 9 - Indexed References
463 Solvers
-
120 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.