501.Print a Reverse Left Half Pyramid Star Pattern
Easy
Given an integer
n, return the n rows of an upside-down right-aligned star pyramid — row i has (i − 1) leading spaces then (n − i + 1) stars.
This is the Left Half Pyramid, flipped: the widest row (all n stars) comes first, narrowing by one star — and gaining one leading space — each row after. Both solutions carry over the Left Half Pyramid's technique directly, just with (i − 1) and (n − i + 1) swapped in for the space and star counts.
Example 1:
Input: n = 4
Output: ["****"," ***"," **"," *"]
Example 2:
Input: n = 1
Output: ["*"]
+ 1 hidden test case run on Submit.
Constraints:
- ●
1 ≤ n ≤ 20
n =
4