![]() |
VOOZH | about |
Given an integer N, create an inverted left half pyramid pattern with N rows. In this pattern, the first row contains N stars, the second row contains N - 1 stars, and each following row has one star less than the previous row, until the last row contains only 1 star. All stars are right-aligned.
Examples:
Input: N = 3
Output:
***
**
*Input: N = 5
Output:
*****
****
***
**
*
The inverted left half pyramid pattern can be printed using two nested loops inside an outer loop. The outer loop controls the rows, the first inner loop prints i - 1 spaces, and the second inner loop prints N - i + 1 stars in the i-th row.
Step-by-Step Approach
***** **** *** ** *