Alphabet Pyramid

Given a positive integer n, return a centered alphabet-palindrome pyramid with n rows. Row i begins with n - i spaces, climbs from A to the ith uppercase…

Given a positive integer n, return a centered alphabet-palindrome pyramid with n rows. Row i begins with n - i spaces, climbs from A to the ith uppercase letter, and mirrors back to A without repeating the peak. Do not place spaces between letters or at the end of a row. Join rows with one newline character and do not add a trailing newline.

- 1 ≤ n ≤ 26 - n is always a positive integer.

Example 1: input n = 4; output A ABA ABCBA ABCDCBA. Row four reaches D once and mirrors back through C, B, and A.

Example 2: input n = 1; output A. The smallest pyramid contains the single letter A.

Category: Pattern Programs. Topic: pattern-programs. Difficulty: Easy. Patterns: math.