Practice/expertDynamic Character Pattern
⏱ 00:00
Best: 0/100
Alphabetical Diamond & Center AlignmentTarget Time: 20 mins

Dynamic Character Pattern

Given an integer N (1 <= N <= 26), print an alphabetical hollow diamond of size 2*N - 1 where row 1 has letter "A", row 2 has "B", down to the N-th letter at the equator, then reflecting back to "A".

Input Format
A single integer N.
Output Format
Print 2*N - 1 rows of the character diamond.
Constraints:1 <= N <= 26
Concepts Required:
Hollow diamond with dynamic character tokensLetter progression A -> B -> C
Expected Pattern PreviewASCII Monospace
    A
   B B
  C   C
 D     D
E       E
 D     D
  C   C
   B B
    A

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

Concrete Examples

Example 1
Input:
5
Output:
    A
   B B
  C   C
 D     D
E       E
 D     D
  C   C
   B B
    A

Explanation: Letters A to E form the borders of the diamond.

← Back to All Challenges