528.Print a Hollow Right Triangle Star Pattern
Easy
Given
n, return the n rows of a hollow right-angled triangle: row i is i characters wide, with stars along the left side, the slanted side and the base, and spaces inside.
It is the Right Half Pyramid with its inside removed. The new idea is that the edge conditionEdge ConditionA boolean test such as j == 1 || j == i || i == n that is true exactly on the outline of the shape. combines column checks (first and last cell) with a row check (the base). No trailing spaces are produced, because every row ends with a star.
Example 1:
Input: n = 5
Output: ["*","**","* *","* *","*****"]
Example 2:
Input: n = 2
Output: ["*","**"]
+ 4 hidden test cases run on Submit.
Constraints:
- ●
1 ≤ n ≤ 20
n =
5