Practice/fresherDiamond Pattern
⏱ 00:00
Best: 0/100
Composite SymmetryTarget Time: 12 mins

Diamond Pattern

Given an integer N, print a symmetric full diamond pattern. The top half is a pyramid of N rows, and the bottom half is an inverted pyramid of (N - 1) rows.

Input Format
A single integer N.
Output Format
Print 2*N - 1 rows forming a diamond.
Constraints:1 <= N <= 15
Concepts Required:
Two-phase loop structure (Upper + Lower)Pyramid and Inverted Pyramid combination
Expected Pattern PreviewASCII Monospace
    *
   ***
  *****
 *******
*********
 *******
  *****
   ***
    *

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

Concrete Examples

Example 1
Input:
5
Output:
    *
   ***
  *****
 *******
*********
 *******
  *****
   ***
    *

Explanation: Upper pyramid of 5 rows, lower pyramid of 4 rows.

← Back to All Challenges