⏱ 00:00
Attempts:0
Best: 0/100
Expanding Matrix GeometryTarget Time: 20 mins
Concentric Number Matrix
Given an integer N, print a concentric square matrix of size (2*N - 1) x (2*N - 1) where the center is 1, and rings increment outwards up to N on the boundary.
Input Format
A single integer N.
Output Format
Print 2*N - 1 rows separated by space.
Constraints:1 <= N <= 9
Concepts Required:
Inverse Chebyshev metric: 1 + max(|i - (N-1)|, |j - (N-1)|)Center-origin transformation
Expected Pattern PreviewASCII Monospace
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
Notice how character spacing and row counts scale systematically based on the input N.
Concrete Examples
Example 1
Input:
3
Output:
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
Explanation: 1 is at center, expanding out to 3.
