Explanation

500.Print a Left Half Pyramid Star Pattern

Easy
Given an integer n, return the n rows of a right-aligned star pyramid — row i has (n − i) leading spaces followed by i stars. This mirrors the Right Half Pyramid, but with the stars pushed to the right edge of each row instead of the left — which is exactly what makes the slanted edge appear on the LEFT side of the shape. The nested loopsNested LoopsAn outer loop over rows, with one inner loop for the leading spaces and another for the stars. version builds each half explicitly; the built-in repetitionBuilt-in RepetitionBuilding the space-padding and the stars each with a repeat call, then concatenating the two pieces — no inner loop at all. version replaces both inner loops with two repeat calls and a concatenation.

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