This solution is outdated. To rescore this solution, sign in.
-
5 Comments
Show
2 older comments
Jeff Connors
on 30 Mar 2020
Phillippe, please delete this solution so we can see the real best answer
Faruk Kaplan
on 4 Jun 2020
function a = checkerboard(n)
b=ones(n);
for i=1:n
for j=1:n
if (mod(i+j,2))
b(i,j)=0;
end
end
end
a=b
end
Phillippe seems like crack-brained with being "leading solutioner".
Sudheer Bhimireddy
on 5 Aug 2020
Where is the best solution?
Huaiyuan Chu
on 14 Aug 2020
function a = checkerboard(n)
t1 = ones(n,1) * (1:n);
t = t1 + t1';
a = bitget(t+1, 1);
end
Chris Liu
on 5 Nov 2020
function a = checkerboard(n)
a = zeros(n);
a(1:2:n,1:2:n)=1
a(2:2:n,2:2:n)=1
end
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!