Given n (always odd), return output a that has concentric rings of the 1s and 0s around the center point. Examples:
Input n = 3
Output a is [ 1 1 1
1 0 1
1 1 1 ]
Input n = 5
Output a is [ 1 1 1 1 1
1 0 0 0 1
1 0 1 0 1
1 0 0 0 1
1 1 1 1 1]
Additional test cases have been added.
Do you know if Matrix Patterns II and Sequences & Series III will become badge eligible problem sets? Thanks!
sorry,just test for regexp solution,it really is not a proper way to do cody.
Output any real number that is neither positive nor negative
Sum the numbers on the main diagonal
Find the hypotenuse
Create incrementing array
Free passes for everyone!
factor to number
Make combination of two given matrices.
Power The Product
Diagonal & Anti-Diagonal Matrix: Easy
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office