Problem 312. Better bullseye matrix
Problem 18 asks to create a bullseye matrix like this:
[ 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 ]
But I think a better one would look like this:
[ 5 4 3 4 5 4 3 2 3 4 3 2 1 2 3 4 3 2 3 4 5 4 3 4 5 ]
Thus given n (always odd), return output a that has concentric rings of the numbers 1 through n around the center point.
Solution Stats
Problem Comments
-
1 Comment
Aamod Garg
on 10 Jun 2018
Its a good problem. Got me back to solving problems at Cody after about 2 months!
Solution Comments
Show commentsProblem Recent Solvers248
Suggested Problems
-
Return the largest number that is adjacent to a zero
5509 Solvers
-
Test if a Number is a Palindrome without using any String Operations
251 Solvers
-
Project Euler: Problem 1, Multiples of 3 and 5
3657 Solvers
-
16228 Solvers
-
Project Euler: Problem 8, Find largest product in a large string of numbers
1301 Solvers
More from this Author39
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!