Practice/mediumNumber Diamond
⏱ 00:00
Best: 0/100
Numeric Pyramids & ReflectionTarget Time: 15 mins

Number Diamond

Given an integer N, print a diamond of numbers where row i of the top half has (N - i) spaces, and numbers start at i, increase to (2*i - 1), then decrease back to i.

Input Format
A single integer N.
Output Format
Print 2*N - 1 rows of a number diamond without spaces between numbers.
Constraints:1 <= N <= 9
Concepts Required:
Dual counter progression in diamondPeak calculation (2*i - 1)Mirrored reflection
Expected Pattern PreviewASCII Monospace
   1
  232
 34543
4567654
 34543
  232
   1

Notice how character spacing and row counts scale systematically based on the input N.

Concrete Examples

Example 1
Input:
4
Output:
   1
  232
 34543
4567654
 34543
  232
   1

Explanation: Top 4 rows ascend and bottom 3 rows descend symmetrically.

← Back to All Challenges