Hollow Star Triangle

Given a positive integer n, return a left-aligned hollow right triangle with n rows. Print stars only on the left edge, the diagonal right edge, and every…

Given a positive integer n, return a left-aligned hollow right triangle with n rows. Print stars only on the left edge, the diagonal right edge, and every position in the final row. Interior cells are spaces. Add no trailing spaces or trailing newline; join rows with one newline.

- 1 ≤ n ≤ 10 - n is always a positive integer. - Row i has visible width i.

Example 1: input n = 5; output * ** * * * * *****. The first and final cell form the sides; the last row closes the boundary.

Example 2: input n = 1; output *. One cell belongs to every boundary.

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