Practice/expertAdvanced Diamond
⏱ 00:00
Best: 0/100
Complex Symmetric PatternTarget Time: 20 mins

Advanced Diamond

Given an integer N, print a framed diamond where the border is asterisks (*), and the interior displays row numbers counting down from row index to 1.

Input Format
A single integer N.
Output Format
Print 2*N - 1 rows of the framed number diamond.
Constraints:1 <= N <= 9
Concepts Required:
Border frame conditionsInterior dynamic numberingDual-phase reflection
Expected Pattern PreviewASCII Monospace
    *
   *1*
  *212*
 *32123*
*4321234*
 *32123*
  *212*
   *1*
    *

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

Concrete Examples

Example 1
Input:
5
Output:
    *
   *1*
  *212*
 *32123*
*4321234*
 *32123*
  *212*
   *1*
    *

Explanation: Enclosed with stars, interior contains palindrome numbers.

← Back to All Challenges