Problem 18. Bullseye Matrix
Given n (always odd), return output a that has concentric rings of the numbers 1 through (n+1)/2 around the center point. Examples:
Input n = 3
Output a is [ 2 2 2
2 1 2
2 2 2 ]
Input n = 5
Output a is [ 3 3 3 3 3
3 2 2 2 3
3 2 1 2 3
3 2 2 2 3
3 3 3 3 3 ]
Solution Stats
Problem Comments
-
33 Comments
Show
30 older comments
Md.
on 11 Feb 2023
hard one
Yên Thế Duy
on 9 Mar 2023
nice
Sanika
on 5 Mar 2024
Thankyou. This code was very helpful.
Solution Comments
Show commentsProblem Recent Solvers5973
Suggested Problems
-
Find the alphabetic word product
3373 Solvers
-
5775 Solvers
-
It dseon't mettar waht oedrr the lrettes in a wrod are.
1899 Solvers
-
10726 Solvers
-
The sum of the numbers in the vector
612 Solvers
More from this Author96
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!