510.Print a Reverse Star Pyramid
Easy
Given an integer
n, return the n rows of an upside-down centered star pyramid — row i has (i − 1) leading spaces, then (2(n − i + 1) − 1) stars.
This is the Full Star Pyramid, flipped: the widest row (2n − 1 stars, no spaces) comes first, shrinking by 2 stars — and gaining one leading space — each row after. Both solutions carry over the Full Star Pyramid's technique directly, just with (i − 1) and (2(n − i + 1) − 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